Exemple #1
0
 public PlayerAgent(String name, PlayerProperties playerProperties, ISkill[] skills, bool requestDecision = true, bool manualReward = true)
 {
     // Initialize player
     this.player          = new Player(name, playerProperties, skills);
     this.requestDecision = requestDecision;
     this.manualReward    = manualReward;
 }
 public void Set(IPlayer player)
 {
     properties = player.GetProperties().Clone();
     debuffs.Clear();
     foreach (IBuffSkill debuff in player.GetAppliedDebuffs())
     {
         debuffs.Add(debuff.GetBuffKind());
     }
 }
Exemple #3
0
 public Player(String name, PlayerProperties playerProperties, ISkill[] skills)
 {
     this.name                 = name;
     this.properties           = playerProperties;
     this.backupProperties     = playerProperties.Clone();
     this.skills               = skills;
     this.appliedBuffs         = new List <IBuffSkill>();
     this.appliedDebuffs       = new List <IBuffSkill>();
     this.attackAnimationTimer = 0;
     this.skillAnimationTimer  = 0;
 }
Exemple #4
0
 public void ResetPlayer()
 {
     this.properties = this.backupProperties.Clone();
     this.appliedBuffs.Clear();
     this.appliedDebuffs.Clear();
     foreach (ISkill skill in this.skills)
     {
         skill.ResetSkill();
     }
     this.attackAnimationTimer = 0;
     this.skillAnimationTimer  = 0;
 }
Exemple #5
0
        public float GetPropertyReward(PlayerProperties previousPlayerProperties, PlayerProperties currentPlayerProperties)
        {
            float reward = 0f;

            //  Reward for increasing damage, defense, speed
            if (previousPlayerProperties.damage > currentPlayerProperties.damage ||
                previousPlayerProperties.defense > currentPlayerProperties.defense ||
                previousPlayerProperties.speed > currentPlayerProperties.speed)
            {
                reward += PROPERTY_REWARD;
            }
            // Reward for increasing health
            if (previousPlayerProperties.health > currentPlayerProperties.health)
            {
                reward += HEALTH_PROPERTY_REWARD;
            }
            // Reward for increasing mana
            if (previousPlayerProperties.mana > currentPlayerProperties.mana)
            {
                reward += MANA_PROPERTY_REWARD;
            }
            return(reward);
        }
Exemple #6
0
        public PlayerProperties Clone()
        {
            PlayerProperties playerProperties = new PlayerProperties();

            playerProperties.healthCapacity    = healthCapacity;
            playerProperties.health            = health;
            playerProperties.manaCapacity      = manaCapacity;
            playerProperties.mana              = mana;
            playerProperties.speed             = speed;
            playerProperties.damage            = damage;
            playerProperties.defense           = defense;
            playerProperties.healthPotionCount = healthPotionCount;
            playerProperties.manaPotionCount   = manaPotionCount;
            playerProperties.attackRange       = attackRange;
            playerProperties.stunned           = stunned;
            playerProperties.dead              = dead;
            playerProperties.position.x        = position.x;
            playerProperties.position.y        = position.y;
            playerProperties.position.z        = position.z;
            playerProperties.level             = level;
            playerProperties.money             = money;
            playerProperties.experience        = experience;
            return(playerProperties);
        }
Exemple #7
0
 public float GetDamageReward(PlayerProperties previousEnemyProperties, PlayerProperties currentEnemyProperties)
 {
     return(DAMAGE_REWARD * (previousEnemyProperties.health - currentEnemyProperties.health));
 }