From 2981e52e383bd11572280e97210d65230c40a5f1 Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Fri, 29 Mar 2019 02:50:22 -0700 Subject: [PATCH] Added set item bonuses to item details (see #21, #24) --- core/src/com/riiablo/item/Item.java | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/core/src/com/riiablo/item/Item.java b/core/src/com/riiablo/item/Item.java index f3fcc9bc..e845c8a8 100644 --- a/core/src/com/riiablo/item/Item.java +++ b/core/src/com/riiablo/item/Item.java @@ -970,10 +970,29 @@ public class Item extends Actor implements Disposable { add(new Label(text, font, Riiablo.colors.blue)).center().space(SPACING).row(); } } - } - //PropertyList setProps = stats[SET_PROPS + 0]; // TODO: + num equipped set items - // TODO: add set property support + if (quality == SET) { + SetItems.Entry setItem = Riiablo.files.SetItems.get(qualityId); + int setId = Riiablo.files.Sets.index(setItem.set); + int numEquipped = owner.SETS_EQUIP.get(setId, 0); + assert numEquipped >= 1; + if (numEquipped >= 2) { + PropertyList setProps = stats[SET_PROPS + numEquipped - 2]; + Array aggregate = setProps.toArray(); + aggregate.sort(new Comparator() { + @Override + public int compare(Stat.Instance o1, Stat.Instance o2) { + return o2.entry.descpriority - o1.entry.descpriority; + } + }); + for (Stat.Instance stat : aggregate) { + String text = stat.format(owner); + if (text == null) continue; + add(new Label(text, font, Riiablo.colors.green)).center().space(SPACING).row(); + } + } + } + } StringBuilder itemFlags = null; if ((Item.this.flags & ETHEREAL) == ETHEREAL) {