Example #1
0
 public override void ApplyActionEffects(IWorldModel worldModel)
 {
     base.ApplyActionEffects(worldModel);
     worldModel.SetProperty(Properties.MANA, 10);
     //disables the target object so that it can't be reused again
     worldModel.SetProperty(this.Target.name, false);
 }
Example #2
0
        public override void ApplyActionEffects(IWorldModel worldModel)
        {
            int maxHP = (int)worldModel.GetProperty(Properties.MAXHP);
            int level = (int)worldModel.GetProperty(Properties.LEVEL);

            worldModel.SetProperty(Properties.LEVEL, level + 1);
            worldModel.SetProperty(Properties.MAXHP, maxHP + 10);
            worldModel.SetProperty(Properties.XP, (int)0);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
            }
        }
Example #9
0
        //method to average out and apply the effects of a sword attack playout in a stochastic world
        private IWorldModel MergeStates(IWorldModel[] testStates, SwordAttack enemy)
        {
            int  hp             = 0;
            int  shieldHP       = 0;
            int  enemyDeadCount = 0;
            bool enemyAlive     = true;
            int  xp             = 0;
            int  n = testStates.Length;

            for (int i = 0; i < n; i++)
            {
                hp       += (int)testStates[i].GetProperty(Properties.HP);
                shieldHP += (int)testStates[i].GetProperty(Properties.SHIELDHP);
                if ((bool)testStates[i].GetProperty(enemy.Target.tag) != true)
                {
                    xp += (int)testStates[i].GetProperty(Properties.XP);
                    enemyDeadCount++;
                }
            }

            hp       = hp / n;
            shieldHP = shieldHP / n;

            if (enemyDeadCount > ((float)n / 2)) //enemy is dead on average, rounded up
            {
                xp         = xp / enemyDeadCount;
                enemyAlive = false;
            }
            else
            {
                xp = 0;
            }

            //returning the testState[0] as the resulting average
            IWorldModel returnState = testStates[0];

            returnState.SetProperty(Properties.HP, hp);
            returnState.SetProperty(Properties.SHIELDHP, shieldHP);
            returnState.SetProperty(enemy.Target.name, enemyAlive);
            returnState.SetProperty(Properties.XP, xp);
            return(returnState);
        }
Example #10
0
        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);
        }