public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); int hp = (int)worldModel.GetProperty(Properties.HP); int shieldHp = (int)worldModel.GetProperty(Properties.SHIELDHP); int xp = (int)worldModel.GetProperty(Properties.XP); //execute the lambda function to calculate received damage based on the creature type int damage = this.dmgRoll.Invoke(); //calculate player's damage int remainingDamage = damage - shieldHp; int remainingShield = Mathf.Max(0, shieldHp - damage); int remainingHP; if (remainingDamage > 0) { remainingHP = hp - remainingDamage; worldModel.SetProperty(Properties.HP, remainingHP); } worldModel.SetProperty(Properties.SHIELDHP, remainingShield); var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL); worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL, surviveValue - remainingDamage); //calculate Hit //attack roll = D20 + attack modifier. Using 7 as attack modifier (+4 str modifier, +3 proficiency bonus) int attackRoll = RandomHelper.RollD20() + 7; if (attackRoll >= enemyAC) { //there was an hit, enemy is destroyed, gain xp //disables the target object so that it can't be reused again worldModel.SetProperty(this.Target.name, false); worldModel.SetProperty(Properties.XP, xp + this.xpChange); var xpValue = worldModel.GetGoalValue(AutonomousCharacter.GAIN_XP_GOAL); worldModel.SetGoalValue(AutonomousCharacter.GAIN_XP_GOAL, xpValue - this.xpChange); } }
public override void ApplyActionEffects(IWorldModel worldModel) { var duration = this.GetDuration(worldModel); var quicknessValue = worldModel.GetGoalValue(AutonomousCharacter.BE_QUICK_GOAL); worldModel.SetGoalValue(AutonomousCharacter.BE_QUICK_GOAL, quicknessValue + duration * 0.1f); var time = (float)worldModel.GetProperty(Properties.TIME); worldModel.SetProperty(Properties.TIME, time + duration); worldModel.SetProperty(Properties.POSITION, Target.transform.position); }
public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL); worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL, surviveValue - this.shieldChange); worldModel.SetProperty(Properties.SHIELDHP, this.shieldChange); var mana = (int)worldModel.GetProperty(Properties.MANA); worldModel.SetProperty(Properties.MANA, mana - 5); }
public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); var goalValue = worldModel.GetGoalValue(AutonomousCharacter.GET_RICH_GOAL); worldModel.SetGoalValue(AutonomousCharacter.GET_RICH_GOAL, goalValue - 5.0f); var money = (int)worldModel.GetProperty(Properties.MONEY); worldModel.SetProperty(Properties.MONEY, money + 5); //disables the target object so that it can't be reused again worldModel.SetProperty(this.Target.name, false); }
public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); var surviveValue = worldModel.GetGoalValue(AutonomousCharacter.SURVIVE_GOAL); worldModel.SetGoalValue(AutonomousCharacter.SURVIVE_GOAL, surviveValue - this.hpChange); var hp = (int)worldModel.GetProperty(Properties.MAXHP); worldModel.SetProperty(Properties.HP, hp); //disables the target object so that it can't be reused again worldModel.SetProperty(this.Target.name, false); }
public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); var xpValue = worldModel.GetGoalValue(AutonomousCharacter.GAIN_XP_GOAL); worldModel.SetGoalValue(AutonomousCharacter.GAIN_XP_GOAL, xpValue - this.xpChange); var xp = (int)worldModel.GetProperty(Properties.XP); worldModel.SetProperty(Properties.XP, xp + this.xpChange); var mana = (int)worldModel.GetProperty(Properties.MANA); worldModel.SetProperty(Properties.MANA, mana - 2); //disables the target object so that it can't be reused again worldModel.SetProperty(this.Target.name, false); }
public override void ApplyActionEffects(IWorldModel worldModel) { base.ApplyActionEffects(worldModel); var goalValue = worldModel.GetGoalValue(AutonomousCharacter.GET_RICH_GOAL); worldModel.SetGoalValue(AutonomousCharacter.GET_RICH_GOAL, goalValue - 5.0f); var mana = (int)worldModel.GetProperty(Properties.MANA); worldModel.SetProperty(Properties.MANA, mana - 10); for (int i = 0; i < 7; i++) { worldModel.SetProperty("Skeleton" + i, false); } for (int i = 0; i < 2; i++) { worldModel.SetProperty("Orc" + i, false); } worldModel.SetProperty("Dragon", false); }