コード例 #1
0
 private void singleTargetAbility(Character actingCharacter, Character target)
 {
     int base_stat = 1;
     if (usedAbility.isMagic)
     {
         base_stat = actingCharacter.getStat(StatEnum.MAGIC);
     }
     else
     {
         base_stat = actingCharacter.getStat(StatEnum.STRENGTH);
     }
     applyAbility(actingCharacter, target, base_stat);
 }
コード例 #2
0
 public void specificAction(Character actingCharacter, Character[] combatants)
 {
     int attack = actingCharacter.getStat(StatEnum.STRENGTH) + actingCharacter.WeaponDamage;
     int damage = attack - target.getStat(StatEnum.ARMOR);
     if (damage > 0)
     {
         target.takeDamage(damage);
         attackResult = " attacked and did " + damage + " to ";
     }
     else
     {
         attackResult = " was unable to damage ";
     }
     battleEvents.Add(new BattleEvent(actingCharacter, this, target));
 }
コード例 #3
0
        private void spreadAbility(Character actingCharacter, Character[] combatants)
        {
            int base_stat = 1;
            if (usedAbility.isMagic)
            {
                base_stat = actingCharacter.getStat(StatEnum.MAGIC);
            }
            else
            {
                base_stat = actingCharacter.getStat(StatEnum.STRENGTH);
            }

            for (int i = 0; i < combatants.Length; i++)
            {
                if (combatants[i].isPlayer && !usedAbility.AffectEnemy || !combatants[i].isPlayer && usedAbility.AffectEnemy)
                {
                    applyAbility(actingCharacter, combatants[i], base_stat);
                }
            }
        }
コード例 #4
0
ファイル: Character.cs プロジェクト: TeamVlissides/SourceRepo
        public bool CompareTo(Character character)
        {
            /* start CompareTo */

            return this.getStat(StatEnum.AGILITY) < character.getStat(StatEnum.AGILITY);
        }
コード例 #5
0
        private void spreadAbility(Character actingCharacter, Character[] combatants)
        {
            int base_stat = 1;
            if (usedAbility.isMagic)
            {
                base_stat = actingCharacter.getStat(StatEnum.MAGIC);
            }
            else
            {
                base_stat = actingCharacter.getStat(StatEnum.STRENGTH);
            }

            /* This loop does not take into account that enemies can have abilities as well. Maybe I didn't communicate that */
            for (int i = 0; i < combatants.Length; i++)
            {
                if (actingCharacter.isPlayer)
                {
                    if ((combatants[i].isPlayer && !usedAbility.AffectEnemy) || (!combatants[i].isPlayer && usedAbility.AffectEnemy))
                        applyAbility(actingCharacter, combatants[i], base_stat);
                }
                else
                {
                    if ((!combatants[i].isPlayer && !usedAbility.AffectEnemy) || (combatants[i].isPlayer && usedAbility.AffectEnemy))
                        applyAbility(actingCharacter, combatants[i], base_stat);
                }
            }
        }