mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-19 16:57:20 +07:00
Refactored attributes modified list with stat-internal modified field
This commit is contained in:
parent
87c372bad5
commit
9a6e17496e
@ -1,7 +1,6 @@
|
||||
package com.riiablo.item;
|
||||
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Bits;
|
||||
import com.riiablo.CharData;
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.codec.excel.ItemStatCost;
|
||||
@ -11,7 +10,7 @@ public class Attributes {
|
||||
final PropertyList agg = new PropertyList();
|
||||
final PropertyList rem = new PropertyList();
|
||||
final Array<PropertyList> propertyLists = new Array<>();
|
||||
final Bits mod = new Bits(1 << Stat.BITS);
|
||||
//final Bits mod = new Bits(1 << Stat.BITS);
|
||||
|
||||
public PropertyList base() {
|
||||
return base;
|
||||
@ -25,9 +24,9 @@ public class Attributes {
|
||||
return rem;
|
||||
}
|
||||
|
||||
public boolean isModified(int stat) {
|
||||
return mod.get(stat);
|
||||
}
|
||||
//public boolean isModified(int stat) {
|
||||
/// return mod.get(stat);
|
||||
//}
|
||||
|
||||
public int size() {
|
||||
return agg.size();
|
||||
@ -40,7 +39,7 @@ public class Attributes {
|
||||
public void reset() {
|
||||
agg.clear();
|
||||
agg.deepCopy(base);
|
||||
mod.clear();
|
||||
//mod.clear();
|
||||
rem.clear();
|
||||
propertyLists.clear();
|
||||
}
|
||||
@ -66,7 +65,7 @@ public class Attributes {
|
||||
rem.addCopy(stat);
|
||||
} else {
|
||||
agg.addCopy(stat);
|
||||
mod.set(stat.id);
|
||||
//mod.set(stat.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,8 +83,8 @@ public class Attributes {
|
||||
int statId = Riiablo.files.ItemStatCost.index(op_stat);
|
||||
Stat opstat = agg.get(statId);
|
||||
if (opstat != null) {
|
||||
opstat.val += op(charData, stat, base.get(statId), op, op_base, op_param);
|
||||
mod.set(opstat.id);
|
||||
opstat.add(op(charData, stat, base.get(statId), op, op_base, op_param));
|
||||
//mod.set(opstat.id);
|
||||
opCount++;
|
||||
}
|
||||
}
|
||||
@ -103,12 +102,12 @@ public class Attributes {
|
||||
case 7: return 0; // by-time percent
|
||||
case 8:
|
||||
agg.addCopy(stat);
|
||||
mod.set(stat.id);
|
||||
//mod.set(stat.id);
|
||||
return stat.val * charData.getCharacterClass().entry().ManaPerMagic; // max mana
|
||||
case 9:
|
||||
if (opstat.id == Stat.maxhp) { // only increment vit on maxhp op
|
||||
agg.addCopy(stat);
|
||||
mod.set(stat.id);
|
||||
//mod.set(stat.id);
|
||||
}
|
||||
return stat.val // max hitpoints
|
||||
* (opstat.id == Stat.maxhp
|
||||
|
@ -965,7 +965,7 @@ public class Item extends Actor implements Disposable {
|
||||
if ((prop = props.agg.get(Stat.armorclass)) != null) {
|
||||
Table table = new Table();
|
||||
table.add(new Label(Riiablo.string.lookup("ItemStats1h") + " ", font));
|
||||
table.add(new Label(Integer.toString(prop.val), font, props.mod.get(Stat.armorclass) ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.add(new Label(Integer.toString(prop.val), font, props.get(Stat.armorclass).isModified() ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.pack();
|
||||
add(table).space(SPACING).row();
|
||||
}
|
||||
@ -982,21 +982,21 @@ public class Item extends Actor implements Disposable {
|
||||
if ((i & 1) != 0 && (prop = props.agg.get(Stat.maxdamage)) != null) {
|
||||
Table table = new Table();
|
||||
table.add(new Label(Riiablo.string.lookup("ItemStats1l") + " ", font));
|
||||
table.add(new Label(props.get(Stat.mindamage).val + " to " + prop.val, font, props.mod.get(Stat.maxdamage) ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.add(new Label(props.get(Stat.mindamage).val + " to " + prop.val, font, props.get(Stat.maxdamage).isModified() ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.pack();
|
||||
add(table).space(SPACING).row();
|
||||
}
|
||||
if ((i & 2) != 0 && (prop = props.agg.get(Stat.secondary_maxdamage)) != null) {
|
||||
Table table = new Table();
|
||||
table.add(new Label(Riiablo.string.lookup("ItemStats1m") + " ", font));
|
||||
table.add(new Label(props.get(Stat.secondary_mindamage).val + " to " + prop.val, font, props.mod.get(Stat.secondary_maxdamage) ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.add(new Label(props.get(Stat.secondary_mindamage).val + " to " + prop.val, font, props.get(Stat.secondary_maxdamage).isModified() ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.pack();
|
||||
add(table).space(SPACING).row();
|
||||
}
|
||||
if (typeEntry.Throwable && (prop = props.agg.get(Stat.item_throw_maxdamage)) != null) {
|
||||
Table table = new Table();
|
||||
table.add(new Label(Riiablo.string.lookup("ItemStats1n") + " ", font));
|
||||
table.add(new Label(props.get(Stat.item_throw_mindamage).val + " to " + prop.val, font, props.mod.get(Stat.item_throw_maxdamage) ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.add(new Label(props.get(Stat.item_throw_mindamage).val + " to " + prop.val, font, props.get(Stat.item_throw_maxdamage).isModified() ? Riiablo.colors.blue : Riiablo.colors.white));
|
||||
table.pack();
|
||||
add(table).space(SPACING).row();
|
||||
}
|
||||
|
@ -531,6 +531,10 @@ public class Stat implements Comparable<Stat>, Pool.Poolable {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Encodings: param -- value (in bits)
|
||||
* 0 : 0 | X
|
||||
@ -561,6 +565,7 @@ public class Stat implements Comparable<Stat>, Pool.Poolable {
|
||||
default:
|
||||
val += other.val;
|
||||
}
|
||||
modified = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -576,6 +581,7 @@ public class Stat implements Comparable<Stat>, Pool.Poolable {
|
||||
default:
|
||||
val += value;
|
||||
}
|
||||
modified = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ public class CharacterPanel extends WidgetGroup implements Disposable {
|
||||
}
|
||||
}
|
||||
|
||||
if (mod && Riiablo.charData.getStats().isModified(stat.id)) {
|
||||
if (mod && Riiablo.charData.getStats().get(stat.id).isModified()) {
|
||||
return Riiablo.colors.blue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user