Example #1
0
        internal static int Heal(SkillStats skill, UnitStats caster)
        {
            float power = caster.MagicPower;

            power *= (float)skill.Power / 100;
            return((int)power);
        }
Example #2
0
 private void ReplaceSkill(SkillStats skill)
 {
     rewards.rewardPanel.SetActive(false);
     unitManager.ChangeDescription("Choose a Skill to replace");
     unitManager.gameManager.ShowSkills();
     unitManager.gameManager.SetReplacing(skill);
 }
Example #3
0
        private void DoStatus(SkillStats skill, Unit caster, Unit target, bool isPlayer, int pos)
        {
            KeyValuePair <bool, int> hit = Damage.Status(skill, caster.Stats, target.Stats);

            if (hit.Key)
            {
                StartCoroutine(DisplayText(pos, "Hit", false, false, false));
                if (isPlayer)
                {
                    log.Add("You hit " + target.NameStr + " with " + skill.NameStr);
                }
                else
                {
                    log.Add(caster.NameStr + " hit you with " + skill.NameStr);
                }
                if (skill.StatusType == Constants.StatusTypes.Blast)
                {
                    target.AddStatus(skill.StatusType, hit.Value, 1);
                }
                target.AddStatus(skill.StatusType, skill.StatusPower, hit.Value);
            }
            else
            {
                if (isPlayer)
                {
                    StartCoroutine(DisplayText(pos, "Miss", false, false, false));
                    log.Add("You missed " + target.NameStr + " with " + skill.NameStr);
                }
                else
                {
                    StartCoroutine(DisplayText(pos, "Dodge", false, false, false));
                    log.Add("You dodged " + caster.NameStr + "'s " + skill.NameStr);
                }
            }
        }
Example #4
0
 private void DoBuff(SkillStats skill, Unit caster, Unit target, bool isPlayer, int pos)
 {
     if (skill.Power >= 0)
     {
         if (skill.BuffType == Constants.BuffTypes.Guard)
         {
             target.AddBuff(skill.BuffType, 1, 1);
         }
         else
         {
             target.AddBuff(skill.BuffType, 1);
         }
         StartCoroutine(DisplayText(pos, "Buff", false, false, false));
         if (isPlayer)
         {
             log.Add("You received a buff of " + skill.NameStr);
         }
         else
         {
             log.Add(caster.NameStr + " buffed " + target.NameStr + " with " + skill.NameStr);
         }
     }
     else
     {
         target.AddBuff(skill.BuffType, 0.5f);
         StartCoroutine(DisplayText(pos, "Debuff", false, false, false));
         log.Add(caster.NameStr + " debuffed " + target.NameStr + " with " + skill.NameStr);
     }
 }
Example #5
0
 public void SetReplacing(SkillStats newSkill)
 {
     foreach (ItemPanel itemPanel in itemPanels)
     {
         itemPanel.IsReplacing = true;
         itemPanel.NewSkill    = newSkill;
     }
 }
Example #6
0
 public void AddSkill(SkillStats skill)
 {
     if (Skills.Count >= Constants.MAX_SKILLS)
     {
         ReplaceSkill(skill);
     }
     else
     {
         Skills.Add(skill);
     }
     unitManager.gameManager.ShowSkills();
 }
Example #7
0
        public void GenerateRewards()
        {
            SkillStats skill      = unitManager.ChooseSkillReward();
            int        chosenSlot = Damage.RandomInt(0, (int)Constants.Slot.Ring);
            Gear       gear       = CreateGear((Constants.Slot)chosenSlot);
            ItemStats  item       = unitManager.player.ChooseItem();

            rewards[(int)Constants.RewardTypes.Skill].ChangeReward(skill, gameManager.GetSkillSprite(skill));
            rewards[(int)Constants.RewardTypes.Gear].ChangeReward(gear, gearAtlas.GetSprite(gear.SpriteName));
            rewards[(int)Constants.RewardTypes.Item].ChangeReward(item, gearAtlas.GetSprite(item.SpriteName));
            rewardPanel.SetActive(true);
        }
Example #8
0
 public void DisplayTooltip()
 {
     if (isItem)
     {
         ItemStats item = player.GetItem(itemId);
         tooltip.AddTooltip(item.NameStr + "\n" + item.Description);
     }
     else
     {
         SkillStats skill = player.unitManager.GetSkill(itemId);
         tooltip.AddTooltip(skill.NameStr + "\n" + skill.Description);
     }
 }
Example #9
0
 private void DoHit(SkillStats skill, Unit caster, Unit target, bool isPlayer, int pos)
 {
     Damage.DamagePacket hit;
     hit = Damage.Hit(skill, caster.Stats, target.Stats);
     if (hit.hit)
     {
         StartCoroutine(DisplayText(pos, hit.damage.ToString(), hit.isWeak, hit.isTechnical, hit.isCrit));
         if (isPlayer)
         {
             log.Add("You hit " + target.NameStr + " with " + skill.NameStr + " for " + hit.damage);
             UpdateAnalysis(target, skill.DamageType);
         }
         else
         {
             log.Add(caster.NameStr + " hit you with " + skill.NameStr + " for " + hit.damage);
         }
     }
     else
     {
         if (isPlayer)
         {
             StartCoroutine(DisplayText(pos, "Miss", hit.isWeak, hit.isTechnical, hit.isCrit));
             log.Add("You missed " + target.NameStr + " with " + skill.NameStr);
         }
         else
         {
             StartCoroutine(DisplayText(pos, "Dodge", hit.isWeak, hit.isTechnical, hit.isCrit));
             log.Add("You dodged " + caster.NameStr + "'s " + skill.NameStr);
         }
     }
     if ((hit.isCrit || hit.isWeak) && !target.IsDown)
     {
         ShowOneMore();
         caster.OneMore = true;
         if (isPlayer)
         {
             log.Add("You knocked " + target.NameStr + " down");
         }
         else
         {
             log.Add(caster.NameStr + " knocks you down");
         }
     }
     target.TakeHit(hit);
     if (isPlayer)
     {
         monsterDisplay[pos].UpdateFill(monsters[pos]);
     }
     UpdateGlobes();
 }
Example #10
0
 public void PrepareSkill(SkillStats skill)
 {
     currentSkill = skill;
     if (skill.SkillType == Constants.SkillTypes.Heal || skill.TargetType == Constants.TargetTypes.All ||
         (skill.SkillType == Constants.SkillTypes.Buff && skill.Power >= 0) ||
         skill.SkillType == Constants.SkillTypes.Break)
     {
         StartCoroutine(CastSkill(skill, player));
         ChangeTargeting(false);
         IsCasting = false;
         return;
     }
     ChangeDescription("Using " + skill.NameStr + " (choose a target)");
     ChangeTargeting(true);
     IsCasting = true;
 }
Example #11
0
        public void ChangeReward(object reward, Sprite sprite)
        {
            switch (rewardType)
            {
            case Constants.RewardTypes.Skill:
                skill = (SkillStats)reward;
                break;

            case Constants.RewardTypes.Gear:
                gear = (Gear)reward;
                break;

            case Constants.RewardTypes.Item:
                item = (ItemStats)reward;
                break;
            }
            image.sprite = sprite;
        }
Example #12
0
        internal SkillStats[] ChooseSkills(MonsterData monster)
        {
            SkillStats[]      chosenSkills = new SkillStats[monster.SkillTypeFull.Length + Constants.FORCED_SKILLS];
            List <SkillStats> match;

            //Add forced skills
            chosenSkills[0] = GetSkill(0);
            for (int i = Constants.FORCED_SKILLS; i < chosenSkills.Length; i++)
            {
                match = FindSkills(gameManager.Level, monster.SkillTypeFull[i - Constants.FORCED_SKILLS]);
                if (match.Count == 0)
                {
                    continue;
                }
                int chosen = Damage.RandomInt(0, match.Count - 1);
                chosenSkills[i] = match[chosen];
            }
            return(chosenSkills);
        }
Example #13
0
        private void DoHeal(SkillStats skill, Unit caster, Unit target, bool isPlayer, int pos)
        {
            int heal = Damage.Heal(skill, caster.Stats);

            target.ChangeHealth(heal);
            StartCoroutine(DisplayText(pos, "+" + heal.ToString(), false, false, false));
            if (isPlayer)
            {
                log.Add("You healed for " + heal);
            }
            else
            {
                log.Add(caster.NameStr + " healed " + target.NameStr + " for " + heal);
            }
            if (!isPlayer)
            {
                monsterDisplay[pos].UpdateFill(monsters[pos]);
            }
            UpdateGlobes();
        }
Example #14
0
 public void Activate()
 {
     if (IsReplacing)
     {
         gameManager.unitManager.player.SwapSkill(id, NewSkill);
         gameManager.EndReplacing();
     }
     else
     {
         if (isItem)
         {
             if (player.unitManager.Turn == UnitManager.Turns.Player)
             {
                 //Use item
                 player.UseItem(itemId);
             }
         }
         else
         {
             if (player.unitManager.Turn == UnitManager.Turns.Player && player.CheckCost(skillCost, costType))
             {
                 SkillStats skill = player.unitManager.GetSkill(itemId);
                 if (skill.SkillType == Constants.SkillTypes.Break)
                 {
                     if (player.GetStatus() != skill.StatusType)
                     {
                         return;
                     }
                 }
                 //Use skill
                 player.unitManager.PrepareSkill(skill);
             }
         }
     }
     UpdateDisplay();
 }
Example #15
0
 public void SwapSkill(int pos, SkillStats newSkill)
 {
     Skills[pos] = newSkill;
 }
Example #16
0
        internal static KeyValuePair <bool, int> Status(SkillStats skill, UnitStats attacker, UnitStats defender)
        {
            bool status         = false;
            bool playerAttacker = false;
            bool playerDefender = false;

            if (attacker.Id == 0)
            {
                playerAttacker = true;
            }
            else if (defender.Id == 0)
            {
                playerDefender = true;
            }
            if (skill.StatusType == Constants.StatusTypes.Blast)
            {
                float power = attacker.MagicPower;
                power *= (float)attacker.StatusPower / 100;
                power *= (float)skill.StatusPower / 100;
                return(new KeyValuePair <bool, int>(true, (int)power));
            }
            //Check evasion
            float accuracy = skill.Accuracy * ((float)attacker.Accuracy / 100);

            //Always hit if evasion <= 0
            if (defender.Evasion > 0)
            {
                accuracy /= (float)defender.Evasion / 100;
                int evasionRoll = RandomInt(1, 100);
                if (ExperimentControl.active)
                {
                    if (playerDefender)
                    {
                        int evasionRoll2 = RandomInt(1, 100);
                        if (evasionRoll2 > evasionRoll)
                        {
                            evasionRoll = evasionRoll2;
                        }
                    }
                }
                if (accuracy < evasionRoll)
                {
                    return(new KeyValuePair <bool, int> (false, 0));
                }
            }
            //Check Status
            float statusChance   = skill.StatusChance;
            int   statusDuration = 2;

            if (statusChance > 0)
            {
                bool statusAttempt;
                if (skill.StatusType >= Constants.StatusTypes.Sleep)
                {
                    statusAttempt  = TryChance(statusChance, attacker.MentalStatusChance, defender.IncMentalStatus, playerAttacker);
                    statusDuration = 4;
                }
                else
                {
                    statusAttempt = TryChance(statusChance, attacker.TypeStatusChance, defender.IncTypeStatus, playerAttacker);
                }
                if (statusAttempt)
                {
                    status = true;
                }
            }
            return(new KeyValuePair <bool, int>(status, statusDuration));
        }
Example #17
0
        public IEnumerator CastSkill(SkillStats skill, Unit caster)
        {
            if (caster.IsPlayer)
            {
                caster.ApplyCost(skill.Cost, skill.CostType);
                ChangeDescription("Using " + skill.NameStr);
            }
            else
            {
                ChangeDescription(caster.NameStr + " uses " + skill.NameStr);
            }
            if (caster.GetStatus() == Constants.StatusTypes.Forget && skill.CostType == Constants.CostTypes.Spell)
            {
                log.Add(caster.NameStr + " forgot how to use spells");
                AdvanceTurn();
            }
            //Guard
            if (skill.SkillType == Constants.SkillTypes.Hidden && skill.BuffType == Constants.BuffTypes.Guard)
            {
                float waitDuration = gameManager.PlayParticle(Constants.SkillTypes.Buff, Constants.MAX_ENEMIES);
                yield return(new WaitForSeconds(waitDuration * 1f));

                DoBuff(skill, caster, caster, true, Constants.MAX_ENEMIES);
            }
            else
            //Find defender(s)
            if (skill.SkillType <= Constants.SkillTypes.Dark || skill.SkillType == Constants.SkillTypes.Hidden)
            {
                float waitDuration;
                //Get Targets
                if (skill.TargetType == Constants.TargetTypes.All && caster.IsPlayer)
                {
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            waitDuration = gameManager.PlayParticle(skill.SkillType, i);
                            yield return(new WaitForSeconds(waitDuration / 2));

                            DoHit(skill, caster, monsters[i], caster.IsPlayer, i);
                        }
                    }
                }
                else if (skill.TargetType == Constants.TargetTypes.Single && caster.IsPlayer)
                {
                    int targetPos = GetFirstTargetPos();
                    if (targetPos != -1)
                    {
                        waitDuration = gameManager.PlayParticle(skill.SkillType, targetPos);
                        Monster target = GetFirstTarget();
                        yield return(new WaitForSeconds(waitDuration));

                        DoHit(skill, caster, target, caster.IsPlayer, targetPos);
                    }
                }
                else if (!caster.IsPlayer)
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoHit(skill, caster, player, false, Constants.MAX_ENEMIES);
                }
            }
            else if (skill.SkillType == Constants.SkillTypes.Heal)
            {
                float waitDuration;
                if (skill.TargetType == Constants.TargetTypes.All && !caster.IsPlayer)
                {
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            waitDuration = gameManager.PlayParticle(skill.SkillType, i);
                            yield return(new WaitForSeconds(waitDuration / 2));

                            DoHeal(skill, caster, monsters[i], caster.IsPlayer, i);
                        }
                    }
                }
                else if (skill.TargetType == Constants.TargetTypes.Single && !caster.IsPlayer)
                {
                    float[] temp = new float[Constants.MAX_ENEMIES];
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            temp[i] = monsters[i].CurrentHealth;
                        }
                        else
                        {
                            temp[i] = Mathf.Infinity;
                        }
                    }
                    int pos = Array.IndexOf(temp, temp.Min());
                    waitDuration = gameManager.PlayParticle(skill.SkillType, pos);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoHeal(skill, caster, monsters[pos], caster.IsPlayer, pos);
                }
                else
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoHeal(skill, caster, caster, true, Constants.MAX_ENEMIES);
                }
            }
            else if (skill.SkillType == Constants.SkillTypes.Break)
            {
                float waitDuration;
                if (!caster.IsPlayer)
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Array.IndexOf(monsters, caster));
                    yield return(new WaitForSeconds(waitDuration * 1f));
                }
                else
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));
                }
                if (caster.GetStatus() == skill.StatusType)
                {
                    caster.RemoveStatus();
                    log.Add("You broke free from your status affliction");
                }
                else
                {
                    log.Add("You tried to break, but you weren't afflicted by that status");
                }
            }
            else if (skill.SkillType == Constants.SkillTypes.Status || skill.SkillType == Constants.SkillTypes.Blast)
            {
                float waitDuration;
                //Get Targets
                if (skill.TargetType == Constants.TargetTypes.All && caster.IsPlayer)
                {
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            waitDuration = gameManager.PlayParticle(skill.SkillType, i);
                            yield return(new WaitForSeconds(waitDuration / 2));

                            DoStatus(skill, caster, monsters[i], caster.IsPlayer, i);
                        }
                    }
                }
                else if (skill.TargetType == Constants.TargetTypes.Single && caster.IsPlayer)
                {
                    int targetPos = GetFirstTargetPos();
                    if (targetPos != -1)
                    {
                        waitDuration = gameManager.PlayParticle(skill.SkillType, targetPos);
                        Monster target = GetFirstTarget();
                        yield return(new WaitForSeconds(waitDuration * 1f));

                        DoStatus(skill, caster, target, caster.IsPlayer, targetPos);
                    }
                }
                else if (!caster.IsPlayer)
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoStatus(skill, caster, player, false, Constants.MAX_ENEMIES);
                }
            }
            else if (skill.SkillType == Constants.SkillTypes.Buff && skill.Power >= 0)
            {
                //Buff
                float waitDuration;
                if (skill.TargetType == Constants.TargetTypes.All && !caster.IsPlayer)
                {
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            waitDuration = gameManager.PlayParticle(skill.SkillType, i);
                            yield return(new WaitForSeconds(waitDuration / 2));

                            DoBuff(skill, caster, monsters[i], caster.IsPlayer, i);
                        }
                    }
                }
                else if (skill.TargetType == Constants.TargetTypes.Single && !caster.IsPlayer)
                {
                    float[] temp = new float[Constants.MAX_ENEMIES];
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            temp[i] = monsters[i].CurrentHealth;
                        }
                        else
                        {
                            temp[i] = Mathf.Infinity;
                        }
                    }
                    int pos = Array.IndexOf(temp, temp.Min());
                    waitDuration = gameManager.PlayParticle(skill.SkillType, pos);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoBuff(skill, caster, monsters[pos], caster.IsPlayer, pos);
                }
                else
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoBuff(skill, caster, caster, true, Constants.MAX_ENEMIES);
                }
            }
            else if (skill.SkillType == Constants.SkillTypes.Buff && skill.Power <= 0)
            {
                //Debuff
                float waitDuration;
                //Get Targets
                if (skill.TargetType == Constants.TargetTypes.All && caster.IsPlayer)
                {
                    for (int i = 0; i < monsters.Length; i++)
                    {
                        if (monsters[i].enabled)
                        {
                            waitDuration = gameManager.PlayParticle(skill.SkillType, i);
                            yield return(new WaitForSeconds(waitDuration / 2));

                            DoBuff(skill, caster, monsters[i], caster.IsPlayer, i);
                        }
                    }
                }
                else if (skill.TargetType == Constants.TargetTypes.Single && caster.IsPlayer)
                {
                    int targetPos = GetFirstTargetPos();
                    if (targetPos != -1)
                    {
                        waitDuration = gameManager.PlayParticle(skill.SkillType, targetPos);
                        Monster target = GetFirstTarget();
                        yield return(new WaitForSeconds(waitDuration * 1f));

                        DoBuff(skill, caster, target, caster.IsPlayer, targetPos);
                    }
                }
                else if (!caster.IsPlayer)
                {
                    waitDuration = gameManager.PlayParticle(skill.SkillType, Constants.MAX_ENEMIES);
                    yield return(new WaitForSeconds(waitDuration * 1f));

                    DoBuff(skill, caster, player, false, Constants.MAX_ENEMIES);
                }
            }
            else
            {
                log.Add("WIP skill");
            }
            ClearDescription();
            if (Turn != Turns.EndGame)
            {
                if (!CheckAlive())
                {
                    yield return(new WaitForSeconds(1f));

                    HideAllHealthBars();
                    rewards.GenerateRewards();
                }
                else
                {
                    if (caster.OneMore)
                    {
                        caster.OneMore = false;
                        HideOneMore();
                        if (!caster.IsPlayer)
                        {
                            MonsterCast((int)Turn - 1);
                        }
                        else
                        {
                            ChangeDescription("Knocked one down! Take another turn");
                        }
                    }
                    else
                    {
                        HideOneMore();
                        yield return(new WaitForSeconds(1f));

                        AdvanceTurn();
                    }
                }
            }
            else
            {
                ChangeDescription("You are Dead");
                yield return(new WaitForSeconds(5f));

                SceneManager.LoadScene(0);
            }
        }
Example #18
0
 public Sprite GetSkillSprite(SkillStats skill)
 {
     return(guiAtlas.GetSprite(skill.SpriteName));
 }
Example #19
0
        internal static DamagePacket Hit(SkillStats skill, UnitStats attacker, UnitStats defender)
        {
            bool playerAttacker = false;
            bool playerDefender = false;

            if (attacker.Id == 0)
            {
                playerAttacker = true;
            }
            else if (defender.Id == 0)
            {
                playerDefender = true;
            }
            //Check evasion
            float accuracy = skill.Accuracy * ((float)attacker.Accuracy / 100);

            //Always hit if evasion <= 0
            if (defender.Evasion > 0)
            {
                accuracy /= (float)defender.Evasion / 100;
                int evasionRoll = RandomInt(1, 100);
                if (ExperimentControl.active)
                {
                    if (playerDefender)
                    {
                        int evasionRoll2 = RandomInt(1, 100);
                        if (evasionRoll2 > evasionRoll)
                        {
                            evasionRoll = evasionRoll2;
                        }
                    }
                }
                if (accuracy < evasionRoll)
                {
                    return(new DamagePacket(false));
                }
            }
            //Hit
            //Set Type
            float power          = 0;
            float defense        = 0;
            float resist         = 0;
            int   statusDuration = 2;

            switch (skill.DamageType)
            {
            case Constants.DamageTypes.Physical:
                power   = attacker.AttackPower;
                defense = defender.AttackDefense;
                resist  = defender.ResistPhysical;
                break;

            case Constants.DamageTypes.Projectile:
                power   = attacker.AttackPower;
                defense = defender.AttackDefense;
                resist  = defender.ResistProjectile;
                break;

            case Constants.DamageTypes.Almighty:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                break;

            case Constants.DamageTypes.Electric:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistElectric;
                break;

            case Constants.DamageTypes.Cold:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistCold;
                break;

            case Constants.DamageTypes.Fire:
                power          = attacker.MagicPower;
                defense        = defender.MagicDefense;
                resist         = defender.ResistFire;
                statusDuration = 4;
                break;

            case Constants.DamageTypes.Wind:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistWind;
                break;

            case Constants.DamageTypes.Arcane:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistArcane;
                break;

            case Constants.DamageTypes.Psychic:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistPsychic;
                break;

            case Constants.DamageTypes.Light:
                power   = attacker.MagicPower;
                defense = defender.MagicDefense;
                resist  = defender.ResistLight;
                break;

            case Constants.DamageTypes.Dark:
                power          = attacker.MagicPower;
                defense        = defender.MagicDefense;
                resist         = defender.ResistDark;
                statusDuration = 4;
                break;
            }
            //Check Weakness
            bool isWeak = false;

            if (resist <= -50)
            {
                isWeak = true;
            }
            //Check Technical
            bool isTechnical  = false;
            bool removeStatus = false;

            Constants.StatusTypes returnStatus = Constants.StatusTypes.None;
            switch (defender.Status)
            {
            case Constants.StatusTypes.None:
                break;

            case Constants.StatusTypes.Shock:
                if (skill.DamageType == Constants.DamageTypes.Physical)
                {
                    power        = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical  = true;
                    removeStatus = true;
                    returnStatus = Constants.StatusTypes.Shock;
                }
                else if (skill.DamageType == Constants.DamageTypes.Arcane)
                {
                    power        = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical  = true;
                    removeStatus = true;
                }
                break;

            case Constants.StatusTypes.Freeze:
                if (skill.DamageType == Constants.DamageTypes.Physical || skill.DamageType == Constants.DamageTypes.Projectile)
                {
                    power        = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical  = true;
                    removeStatus = true;
                }
                else if (skill.DamageType == Constants.DamageTypes.Arcane)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Burn:
                if (skill.DamageType == Constants.DamageTypes.Arcane)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Sleep:
                power       = (int)(power * Constants.TECHNICAL_MULTI);
                isTechnical = true;
                break;

            case Constants.StatusTypes.Forget:
                if (skill.DamageType == Constants.DamageTypes.Psychic)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Berserk:
                if (skill.DamageType == Constants.DamageTypes.Psychic)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Confuse:
                if (skill.DamageType == Constants.DamageTypes.Psychic)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Brainwash:
                if (skill.DamageType == Constants.DamageTypes.Psychic)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;

            case Constants.StatusTypes.Fear:
                if (skill.DamageType == Constants.DamageTypes.Psychic)
                {
                    power       = (int)(power * Constants.TECHNICAL_MULTI);
                    isTechnical = true;
                }
                break;
            }
            //Check Crit
            bool isCrit = false;

            if (TryChance(skill.CritChance, attacker.CritChance, defender.IncCritChance, playerAttacker))
            {
                isCrit = true;
                float critMulti = attacker.CritMulti * ((float)skill.CritMulti / 100);
                power *= critMulti / 100;
            }
            //Check Status
            float statusChance = skill.StatusChance;

            statusChance *= (100 - resist) / 100;
            Constants.StatusTypes status = Constants.StatusTypes.None;
            if (!isTechnical)
            {
                if (statusChance > 0)
                {
                    if (isCrit)
                    {
                        statusChance *= Constants.CRITICAL_STATUS_MULTI;
                    }
                    bool statusAttempt;
                    if (skill.StatusType >= Constants.StatusTypes.Sleep)
                    {
                        statusAttempt = TryChance(statusChance, attacker.MentalStatusChance, defender.IncMentalStatus, playerAttacker);
                    }
                    else
                    {
                        statusAttempt = TryChance(statusChance, attacker.TypeStatusChance, defender.IncTypeStatus, playerAttacker);
                    }
                    if (statusAttempt)
                    {
                        status = skill.StatusType;
                    }
                }
            }
            //Calculate final power
            power *= (100 - resist) / 100;
            float statusPower = 0;

            if (status != Constants.StatusTypes.None)
            {
                statusPower  = power;
                statusPower *= (float)attacker.StatusPower / 100;
                statusPower *= (float)skill.StatusPower / 100;
            }
            if (defense > 0)
            {
                power /= defense / 100;
            }
            power *= (float)skill.Power / 100;
            DamagePacket packet = new DamagePacket(true, (int)power, (int)statusPower, isWeak, isTechnical, removeStatus, status, returnStatus, isCrit, statusDuration);

            return(packet);
        }