mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-02-01 02:14:32 +07:00
Added sets parameter to Item#update
Passed sets map should correspond to any set-counting entity (player or hireling) Added fix to ignore CharStats.Entry field in Attributes#op if null (for hirelings)
This commit is contained in:
parent
b5303828a9
commit
f5552947dc
@ -212,7 +212,7 @@ public class CharData {
|
||||
final int alternate = getAlternate();
|
||||
for (Item item : equipped.values()) {
|
||||
if (item == null) continue;
|
||||
item.update(stats, classId.entry());
|
||||
item.update(stats, classId.entry(), getSets());
|
||||
if (item.bodyLoc == BodyLoc.getAlternate(item.bodyLoc, alternate)) {
|
||||
stats.add(item.props.remaining());
|
||||
Stat stat;
|
||||
@ -298,7 +298,7 @@ public class CharData {
|
||||
break;
|
||||
case EQUIPPED:
|
||||
setEquipped(item.bodyLoc, item);
|
||||
item.update(stats, classId.entry());
|
||||
item.update(stats, classId.entry(), getSets());
|
||||
if (item.bodyLoc == BodyLoc.getAlternate(item.bodyLoc, getAlternate())) {
|
||||
stats.add(item.props.remaining());
|
||||
Stat stat;
|
||||
@ -309,7 +309,7 @@ public class CharData {
|
||||
break;
|
||||
case STORED:
|
||||
store.get(item.storeLoc).add(item);
|
||||
item.update(stats, classId.entry());
|
||||
item.update(stats, classId.entry(), getSets());
|
||||
if (item.storeLoc == INVENTORY && item.type.is(Type.CHAR)) {
|
||||
stats.add(item.props.remaining());
|
||||
}
|
||||
@ -378,7 +378,7 @@ public class CharData {
|
||||
|
||||
public Item setEquipped(BodyLoc bodyLoc, Item item) {
|
||||
Item oldItem = equipped.put(bodyLoc, item);
|
||||
if (item != null) item.update(stats, classId.entry());
|
||||
if (item != null) item.update(stats, classId.entry(), getSets());
|
||||
updateSets(oldItem, item);
|
||||
updateStats();
|
||||
notifyEquippedChanged(bodyLoc, oldItem, item);
|
||||
|
@ -101,10 +101,12 @@ public class Attributes {
|
||||
case 6: return 0; // by-time
|
||||
case 7: return 0; // by-time percent
|
||||
case 8:
|
||||
if (charStats == null) return 0;
|
||||
agg.addCopy(stat);
|
||||
//mod.set(stat.id);
|
||||
return stat.val * charStats.ManaPerMagic; // max mana
|
||||
case 9:
|
||||
if (charStats == null) return 0;
|
||||
if (opstat.id == Stat.maxhp) { // only increment vit on maxhp op
|
||||
agg.addCopy(stat);
|
||||
//mod.set(stat.id);
|
||||
|
@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
|
||||
import com.badlogic.gdx.utils.Array;
|
||||
import com.badlogic.gdx.utils.Disposable;
|
||||
import com.badlogic.gdx.utils.GdxRuntimeException;
|
||||
import com.badlogic.gdx.utils.IntIntMap;
|
||||
import com.badlogic.gdx.utils.ObjectMap;
|
||||
import com.riiablo.CharacterClass;
|
||||
import com.riiablo.Riiablo;
|
||||
@ -347,7 +348,7 @@ public class Item extends Actor implements Disposable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public void update(Attributes attrs, CharStats.Entry charStats) {
|
||||
public void update(Attributes attrs, CharStats.Entry charStats, IntIntMap equippedSets) {
|
||||
if ((flags & COMPACT) == COMPACT) return;
|
||||
props.reset();
|
||||
if (stats[MAGIC_PROPS] != null) props.add(stats[MAGIC_PROPS]);
|
||||
@ -362,7 +363,7 @@ public class Item extends Actor implements Disposable {
|
||||
if (quality == SET && location == EQUIPPED) {
|
||||
SetItems.Entry setItem = (SetItems.Entry) qualityData;
|
||||
int setId = Riiablo.files.Sets.index(setItem.set);
|
||||
int numEquipped = Riiablo.charData.getSets().get(setId, 0);
|
||||
int numEquipped = equippedSets.get(setId, 0);
|
||||
if (numEquipped >= 2) {
|
||||
for (int i = 0; i < numEquipped; i++) {
|
||||
props.add(stats[SET_PROPS + i]);
|
||||
@ -374,7 +375,7 @@ public class Item extends Actor implements Disposable {
|
||||
|
||||
public Details details() {
|
||||
if (details == null) {
|
||||
update(Riiablo.charData.getStats(), Riiablo.charData.getCharacterClass().entry());
|
||||
update(Riiablo.charData.getStats(), Riiablo.charData.getCharacterClass().entry(), Riiablo.charData.getSets());
|
||||
details = new Details();
|
||||
}
|
||||
return details;
|
||||
|
Loading…
Reference in New Issue
Block a user