コード例 #1
0
ファイル: Acting.cs プロジェクト: nicojans/FinalQuest
 public void ResetSelection()
 {
     State = ActingState.Cooldown;
     SkillSelected = new SkillData() { Name = "" };
     PossibleTargets = new List<Entity>();
     Targets = new List<Entity>();
     CanTargetGroup = false;
 }
コード例 #2
0
ファイル: BattleEngine.cs プロジェクト: nicojans/FinalQuest
 public static void UseSkill(Entity user, SkillData skillData, List<Entity> targets)
 {
     foreach(Entity target in targets)
     {
         if (target.GetComponent<BattleStats>() != null)
         {
             if (skillData.IsTargetingDead == target.GetComponent<BattleStats>().IsDead)
             {
                 Act(user, skillData, target, targets.Count > 1);
             }
         }
     }
 }
コード例 #3
0
ファイル: BattleEngine.cs プロジェクト: nicojans/FinalQuest
        private static void Act(Entity user, SkillData skill, Entity target, bool multiTargets)
        {
            BattleStats userStats = user.GetComponent<BattleStats>();
            BattleStats targetStats = target.GetComponent<BattleStats>();

            if (skill.IsAttack)
            {
                if (skill.IsDamaging)
                {
                    double attack = 2 * userStats.Attributes[skill.Att1] + userStats.Attributes[skill.Att2] + skill.AttackModifier;
                    double defense = 2 * targetStats.Attributes[skill.Def1] + targetStats.Attributes[skill.Def2];
                    double hitCoefficient = CoefficientPrecision(attack - defense + RNG.GetDouble(-2, 2));
                    double damage = skill.Damage * hitCoefficient;

                    if (skill.CanDefend)
                    {

                        damage *= (skill.IsMagical ? userStats.Attributes[AttributeType.MWeapon] - targetStats.Attributes[AttributeType.MArmor] : userStats.Attributes[AttributeType.PWeapon] - targetStats.Attributes[AttributeType.PArmor]) / 10.0;
                    }
                    DamageTarget(user, target, (int)Math.Ceiling(damage), hitCoefficient);
                    if (skill.HasEffect && hitCoefficient > 0)
                    {
                        EntityCreator.CreateEffect(target, skill.Effect.Type, skill.Effect.Amount, skill.Effect.Duration * ActingSystem.TurnDuration);
                    }
                }
            }
            else
            {
                if (skill.IsDamaging)
                {
                    double power = Math.Pow(1.03, 2 * userStats.Attributes[skill.Pow1] + userStats.Attributes[skill.Pow2] + skill.PowerModifier) * 10;
                    int heal = (int)(power * RNG.GetDouble(0.75, 1.25));
                    HealTarget(user, target, heal);
                    if (skill.HasEffect)
                    {
                        EntityCreator.CreateEffect(target, skill.Effect.Type, skill.Effect.Amount, skill.Effect.Duration * ActingSystem.TurnDuration);
                    }
                }
            }
        }