item charges: Fix Amulet of Chemistry charges for low-dose potions (#11825)
Prior to this change, an amulet of chemistry creating potions of any dose amount less than four (by using it when mixing one-dose Stamina potions, for instance) would not have its charge count updated.
This commit is contained in:
@@ -62,6 +62,15 @@ public class ItemChargePluginTest
|
||||
private static final String USED_RING_OF_FORGING = "You retrieve a bar of iron.";
|
||||
private static final String BREAK_RING_OF_FORGING = "<col=7f007f>Your Ring of Forging has melted.</col>";
|
||||
|
||||
private static final String CHECK_AMULET_OF_CHEMISTRY = "Your amulet of chemistry has 5 charges left.";
|
||||
private static final String CHECK_AMULET_OF_CHEMISTRY_1 = "Your amulet of chemistry has 1 charge left.";
|
||||
private static final String USED_AMULET_OF_CHEMISTRY = "Your amulet of chemistry helps you create a 4-dose potion. It has 4 charges left.";
|
||||
private static final String USED_AMULET_OF_CHEMISTRY_3_DOSES = "Your amulet of chemistry helps you create a 3-dose potion. It has 2 charges left.";
|
||||
private static final String USED_AMULET_OF_CHEMISTRY_2_DOSES = "Your amulet of chemistry helps you create a 2-dose potion. It has one charge left.";
|
||||
private static final String BREAK_AMULET_OF_CHEMISTRY = "Your amulet of chemistry helps you create a 4-dose potion. It then crumbles to dust.";
|
||||
private static final String BREAK_AMULET_OF_CHEMISTRY_3_DOSES = "Your amulet of chemistry helps you create a 3-dose potion. It then crumbles to dust.";
|
||||
private static final String BREAK_AMULET_OF_CHEMISTRY_2_DOSES = "Your amulet of chemistry helps you create a 2-dose potion. It then crumbles to dust.";
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private Client client;
|
||||
@@ -143,5 +152,46 @@ public class ItemChargePluginTest
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).ringOfForging(eq(140));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(5));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", CHECK_AMULET_OF_CHEMISTRY_1, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(1));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(4));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_3_DOSES, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(2));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_AMULET_OF_CHEMISTRY_2_DOSES, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(1));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(5));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_3_DOSES, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(5));
|
||||
reset(config);
|
||||
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BREAK_AMULET_OF_CHEMISTRY_2_DOSES, "", 0);
|
||||
itemChargePlugin.onChatMessage(chatMessage);
|
||||
verify(config).amuletOfChemistry(eq(5));
|
||||
reset(config);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user