Use correct mana values for grand crystals and crystal shards in scroll creation
This commit is contained in:
@@ -49,9 +49,13 @@ public class ItemBlankScroll extends Item implements IWorkbenchItem {
|
|||||||
// Continuous spell scrolls require enough mana to cast them for the duration defined in ItemScroll.
|
// Continuous spell scrolls require enough mana to cast them for the duration defined in ItemScroll.
|
||||||
if(spell.isContinuous) cost *= ItemScroll.CASTING_TIME / 20;
|
if(spell.isContinuous) cost *= ItemScroll.CASTING_TIME / 20;
|
||||||
|
|
||||||
if(crystals.getStack().getCount() * Constants.MANA_PER_CRYSTAL > cost){
|
int manaPerItem = Constants.MANA_PER_CRYSTAL;
|
||||||
|
if(crystals.getStack().getItem() == WizardryItems.crystal_shard) manaPerItem = Constants.MANA_PER_SHARD;
|
||||||
|
if(crystals.getStack().getItem() == WizardryItems.grand_crystal) manaPerItem = Constants.GRAND_CRYSTAL_MANA;
|
||||||
|
|
||||||
|
if(crystals.getStack().getCount() * manaPerItem > cost){
|
||||||
// Rounds up to the nearest whole crystal
|
// Rounds up to the nearest whole crystal
|
||||||
crystals.decrStackSize(cost / Constants.MANA_PER_CRYSTAL + 1);
|
crystals.decrStackSize(cost / manaPerItem + 1);
|
||||||
centre.putStack(new ItemStack(WizardryItems.scroll, centre.getStack().getCount(), spell.metadata()));
|
centre.putStack(new ItemStack(WizardryItems.scroll, centre.getStack().getCount(), spell.metadata()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user