Bugfix: also apply inventory effects to ring in right slot.

This commit is contained in:
Oskar Wiksten
2012-07-24 12:46:20 +02:00
parent ec86093746
commit 84fe0ce155
3 changed files with 10 additions and 8 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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];