Made the aspected Sentient Tools drop their corresponding Will type on killing enemies. #753
This commit is contained in:
parent
6c4fe34152
commit
655c2880dc
13 changed files with 103 additions and 42 deletions
|
@ -12,7 +12,7 @@ public interface IDemonWill
|
|||
*
|
||||
* @return - The amount of Will an ItemStack contains
|
||||
*/
|
||||
double getWill(ItemStack willStack);
|
||||
double getWill(EnumDemonWillType type, ItemStack willStack);
|
||||
|
||||
/**
|
||||
* Sets the amount of Will in a given ItemStack.
|
||||
|
@ -22,7 +22,7 @@ public interface IDemonWill
|
|||
* @param will
|
||||
* - The amount of will to set the stack to
|
||||
*/
|
||||
void setWill(ItemStack willStack, double will);
|
||||
void setWill(EnumDemonWillType type, ItemStack willStack, double will);
|
||||
|
||||
/**
|
||||
* Drains the demonic will from the willStack. If all of the will is
|
||||
|
@ -35,7 +35,7 @@ public interface IDemonWill
|
|||
*
|
||||
* @return The amount of will drained.
|
||||
*/
|
||||
double drainWill(ItemStack willStack, double drainAmount);
|
||||
double drainWill(EnumDemonWillType type, ItemStack willStack, double drainAmount);
|
||||
|
||||
/**
|
||||
* Creates a new ItemStack with the specified number of will. Implementation
|
||||
|
@ -49,4 +49,6 @@ public interface IDemonWill
|
|||
* @return - An ItemStack with the set amount of Will
|
||||
*/
|
||||
ItemStack createWill(int meta, double number);
|
||||
|
||||
EnumDemonWillType getType(ItemStack stack);
|
||||
}
|
||||
|
|
|
@ -30,9 +30,9 @@ public class PlayerDemonWillHandler
|
|||
{
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWill)
|
||||
if (stack.getItem() instanceof IDemonWill && ((IDemonWill) stack.getItem()).getType(stack) == type)
|
||||
{
|
||||
souls += ((IDemonWill) stack.getItem()).getWill(stack);
|
||||
souls += ((IDemonWill) stack.getItem()).getWill(type, stack);
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
souls += ((IDemonWillGem) stack.getItem()).getWill(type, stack);
|
||||
|
@ -112,10 +112,10 @@ public class PlayerDemonWillHandler
|
|||
ItemStack stack = inventory[i];
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack.getItem() instanceof IDemonWill)
|
||||
if (stack.getItem() instanceof IDemonWill && ((IDemonWill) stack.getItem()).getType(stack) == type)
|
||||
{
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(stack) <= 0)
|
||||
consumed += ((IDemonWill) stack.getItem()).drainWill(type, stack, amount - consumed);
|
||||
if (((IDemonWill) stack.getItem()).getWill(type, stack) <= 0)
|
||||
inventory[i] = null;
|
||||
} else if (stack.getItem() instanceof IDemonWillGem)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue