Пример #1
0
        public void calculateDamageEffects(UnitController uc)
        {
            Animation a = Animation.getAnimation("UNIT-CHARGE-EXPLODE");

            a.m_color = Color.DarkRed;
            a.setSlide(0);
            m_unit.m_animations.Add(a);

            float power = ((float)uc.m_unit.m_stats["POWER"] / (float)m_unit.m_stats["ENDURE"]);

            power  = (float)Math.Pow((double)power, (double)DAMAGECONSTANT);
            power *= uc.m_unit.m_weapon.m_swingData[uc.m_swingCount]["BASE-DAMAGE"];

            m_unit.m_stats["HP"]  -= (int)Math.Ceiling(power);
            m_unit.m_stats["CHP"] -= (int)Math.Ceiling(power / 4);

            uc.trySetTarget(this);

            if (m_unit.m_stats["HP"] <= 0)
            {
                uc.tryRemoveTarget(this);
                if (m_unit.m_important)
                {
                    Random ran = new Random();
                    if (ran.Next(100) <= 10)
                    {
                        m_unit.m_stats["CHP"] = (int)((float)m_unit.m_stats["CHP"] / 1.2);
                        Debug.WriteLine("YOU HAVE BEEN WOUNDED");
                    }
                    else if (ran.Next(100) >= 95)
                    {
                        m_unit.m_stats["CHP"] = 0;
                        action = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
                        Debug.WriteLine("YOU HAVE DIED LOL");
                        m_unit.m_alive = false;
                    }
                    else
                    {
                        Debug.WriteLine("YOU HAVE BEEN ROUTED");
                    }
                    attemptHealHealth(9999);
                    attemptHealFocus(9999);
                    m_unit.x_pos = -100; m_unit.y_pos = -100;
                }
                else
                {
                    m_unit.m_alive        = false;
                    m_unit.m_stats["CHP"] = 0;
                    action = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
                }
                uc.m_unit.m_killCount++;
            }


            if (m_unit.m_stats["CHP"] <= 0)
            {
                m_unit.m_alive = false;
                action         = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
            }
        }
Пример #2
0
        public void calculateDamageEffects(UnitController uc)
        {
            Animation a = Animation.getAnimation("UNIT-CHARGE-EXPLODE");
            a.m_color = Color.DarkRed;
            a.setSlide(0);
            m_unit.m_animations.Add(a);

            float power = ((float)uc.m_unit.m_stats["POWER"] / (float)m_unit.m_stats["ENDURE"]);
            power = (float) Math.Pow((double)power, (double)DAMAGECONSTANT);
            power *= uc.m_unit.m_weapon.m_swingData[uc.m_swingCount]["BASE-DAMAGE"];

            m_unit.m_stats["HP"] -= (int)Math.Ceiling(power);
            m_unit.m_stats["CHP"] -= (int)Math.Ceiling(power/4);

            uc.trySetTarget(this);

            if ( m_unit.m_stats["HP"] <= 0 )
            {
                uc.tryRemoveTarget(this);
                if ( m_unit.m_important )
                {
                    Random ran = new Random();
                    if ( ran.Next(100) <= 10 )
                    {
                        m_unit.m_stats["CHP"] = (int)((float)m_unit.m_stats["CHP"] / 1.2);
                        Debug.WriteLine("YOU HAVE BEEN WOUNDED");
                    }
                    else if ( ran.Next(100) >= 95 )
                    {
                        m_unit.m_stats["CHP"] = 0;
                        action = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
                        Debug.WriteLine("YOU HAVE DIED LOL");
                        m_unit.m_alive = false;
                    }
                    else {
                        Debug.WriteLine("YOU HAVE BEEN ROUTED");
                    }
                    attemptHealHealth(9999);
                    attemptHealFocus(9999);
                    m_unit.x_pos = -100; m_unit.y_pos = -100;
                }
                else {
                    m_unit.m_alive = false;
                    m_unit.m_stats["CHP"] = 0;
                    action = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
                }
                uc.m_unit.m_killCount++;
            }

            if (m_unit.m_stats["CHP"] <= 0)
            {
                m_unit.m_alive = false;
                action = CommandTimer.getCommandFromTemplate("UNIT-DEAD");
            }
        }