From: Oskar Wiksten Date: Tue, 24 Jul 2012 10:46:20 +0000 (+0200) Subject: Bugfix: also apply inventory effects to ring in right slot. X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=84fe0ce155cce8f1ea98c6bfc217b1d262f45722;p=users%2Fmchehab%2Fandors-trail.git Bugfix: also apply inventory effects to ring in right slot. --- diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/HeroinfoActivity_Inventory.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/HeroinfoActivity_Inventory.java index 6906ce2..735cadc 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/HeroinfoActivity_Inventory.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/activity/HeroinfoActivity_Inventory.java @@ -83,8 +83,8 @@ public final class HeroinfoActivity_Inventory extends Activity { setWearSlot(Inventory.WEARSLOT_FEET, R.id.heroinfo_worn_feet, R.drawable.equip_feet); setWearSlot(Inventory.WEARSLOT_NECK, R.id.heroinfo_worn_neck, R.drawable.equip_neck); setWearSlot(Inventory.WEARSLOT_HAND, R.id.heroinfo_worn_hand, R.drawable.equip_hand); - setWearSlot(Inventory.WEARSLOT_RING, R.id.heroinfo_worn_ringleft, R.drawable.equip_ring); - setWearSlot(Inventory.WEARSLOT_RING+1, R.id.heroinfo_worn_ringright, R.drawable.equip_ring); + setWearSlot(Inventory.WEARSLOT_LEFTRING, R.id.heroinfo_worn_ringleft, R.drawable.equip_ring); + setWearSlot(Inventory.WEARSLOT_RIGHTRING, R.id.heroinfo_worn_ringright, R.drawable.equip_ring); } @Override @@ -139,8 +139,8 @@ public final class HeroinfoActivity_Inventory extends Activity { int slot = itemType.category.inventorySlot; if (player.inventory.isEmptySlot(slot)) return slot; - if (slot == Inventory.WEARSLOT_RING) { - return slot + 1; + if (slot == Inventory.WEARSLOT_LEFTRING) { + return Inventory.WEARSLOT_RIGHTRING; } else if (itemType.isOffhandCapableWeapon()) { ItemType mainWeapon = player.inventory.wear[Inventory.WEARSLOT_WEAPON]; if (mainWeapon != null && mainWeapon.isTwohandWeapon()) return slot; @@ -200,7 +200,7 @@ public final class HeroinfoActivity_Inventory extends Activity { if (type.isEquippable()) { menu.findItem(R.id.inv_menu_equip).setVisible(true); if (type.isOffhandCapableWeapon()) menu.findItem(R.id.inv_menu_equip_offhand).setVisible(true); - else if (type.category.inventorySlot == Inventory.WEARSLOT_RING) menu.findItem(R.id.inv_menu_equip_offhand).setVisible(true); + else if (type.category.inventorySlot == Inventory.WEARSLOT_LEFTRING) menu.findItem(R.id.inv_menu_equip_offhand).setVisible(true); } break; } diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ItemController.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ItemController.java index 41cfe90..706193c 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ItemController.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/controller/ItemController.java @@ -113,7 +113,8 @@ public final class ItemController { applyInventoryEffects(player, Inventory.WEARSLOT_HAND); applyInventoryEffects(player, Inventory.WEARSLOT_FEET); applyInventoryEffects(player, Inventory.WEARSLOT_NECK); - applyInventoryEffects(player, Inventory.WEARSLOT_RING); + applyInventoryEffects(player, Inventory.WEARSLOT_LEFTRING); + applyInventoryEffects(player, Inventory.WEARSLOT_RIGHTRING); SkillController.applySkillEffectsFromItemProficiencies(player); SkillController.applySkillEffectsFromFightingStyles(player); diff --git a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/item/Inventory.java b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/item/Inventory.java index d217568..5c3f31d 100644 --- a/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/item/Inventory.java +++ b/AndorsTrail/src/com/gpl/rpg/AndorsTrail/model/item/Inventory.java @@ -15,10 +15,11 @@ public final class Inventory extends ItemContainer { public static final int WEARSLOT_HAND = 4; public static final int WEARSLOT_FEET = 5; public static final int WEARSLOT_NECK = 6; - public static final int WEARSLOT_RING = 7; + public static final int WEARSLOT_LEFTRING = 7; + public static final int WEARSLOT_RIGHTRING = 8; public int gold = 0; - public static final int NUM_WORN_SLOTS = WEARSLOT_RING+1+1; // +1 for 0 based index. +1 for left+right rings. + public static final int NUM_WORN_SLOTS = WEARSLOT_RIGHTRING+1; // +1 for 0 based index. public static final int NUM_QUICK_SLOTS = 3; public final ItemType[] wear = new ItemType[NUM_WORN_SLOTS]; public final ItemType[] quickitem = new ItemType[NUM_QUICK_SLOTS];