public EItemUsageType consumeItem(ITMItem aItem,bool aFullConsume) { switch(aItem.Type()) { case(EItemType.Bait):return useBaitOnMonster(aItem,aFullConsume); case(EItemType.BattleBoost):return useBattleBoostOnMonster(aItem,aFullConsume); case(EItemType.Collar):return useCollarOnMonster(aItem,aFullConsume); case(EItemType.Recovery):return useRecoveryItemOnMonster((ItemRecoveryItem) aItem,aFullConsume); case(EItemType.Quest):return useQuestItemOnMonster(aItem,aFullConsume); case(EItemType.Vitamin):return useVitaminOnMonster((ItemVitamin) aItem,aFullConsume); } return EItemUsageType.UseFailed; }
public IEnumerator consumeItem(ITMItem aItem,MoveQueueItem aMoveQueue) { yield return new WaitForSeconds(0.5f); float hpBefore = this._monsterRef.hp; float energyBefore = this._monsterRef.energy; this._monsterRef.consumeItem(aItem,true); if(aItem.Type()==EItemType.BattleBoost) { this.applyStatEffectsFromMove((BattleBoostItem) aItem,aMoveQueue); } float hpNow = this._monsterRef.hp; float hpDiff = hpNow - hpBefore; this._monsterRef.hp -= hpDiff; if(hpDiff>0) { this.addHP(hpDiff,aMoveQueue.actioningTeam.teamPosition,aMoveQueue.actionPosition); } float energyNow = this._monsterRef.energy; float energyDiff = energyNow-energyBefore; if(energyDiff>0) { this.addEnergy(energyDiff,aMoveQueue.actioningTeam.teamPosition,aMoveQueue.actionPosition); } yield return new WaitForSeconds(0.5f); aMoveQueue.skipToFinish(); }