public override ExecutionResult Execute(SuperMetroidModel model, InGameState inGameState, int times = 1, bool usePreviousRoom = false) { int damage = model.Rules.CalculateEnemyDamage(inGameState, Attack) * Hits * times; if (inGameState.IsResourceAvailable(model, ConsumableResourceEnum.ENERGY, damage)) { InGameState resultingState = inGameState.Clone(); resultingState.ApplyConsumeResource(model, ConsumableResourceEnum.ENERGY, damage); ExecutionResult result = new ExecutionResult(resultingState); result.AddDamageReducingItemsInvolved(model.Rules.GetEnemyDamageReducingItems(model, inGameState, Attack)); return(result); } else { return(null); } }
public override ExecutionResult Execute(SuperMetroidModel model, InGameState inGameState, int times = 1, bool usePreviousRoom = false) { int damage = CalculateDamage(model, inGameState, times: times, usePreviousRoom: usePreviousRoom); if (inGameState.IsResourceAvailable(model, ConsumableResourceEnum.ENERGY, damage)) { var resultingState = inGameState.Clone(); resultingState.ApplyConsumeResource(model, ConsumableResourceEnum.ENERGY, damage); ExecutionResult result = new ExecutionResult(resultingState); result.AddDamageReducingItemsInvolved(GetDamageReducingItems(model, inGameState)); return(result); } else { return(null); } }