Beispiel #1
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var ship = source.PlayerShip();

            if (!ship)
            {
                return(false);
            }

            float hpPc      = skill.GetFloatInput("hp_pc");
            float maxResist = skill.GetFloatInput("max_resist");
            float speedPc   = skill.GetFloatInput("speed_pc");
            float time      = skill.GetFloatInput("time");

            var damagable = source.Damagable();

            var bonuses = source.Bonuses();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            if (damagable.health < damagable.maximumHealth * hpPc)
            {
                float currentResistance    = ship.commonResist;
                float resistanceDifference = Mathf.ClampLess(maxResist - currentResistance, 0f);
                Buff  buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, time, resistanceDifference);
                bonuses.SetBuff(buff, source);
            }

            Buff speedBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, time, speedPc);

            bonuses.SetBuff(speedBuff, source);
            return(true);
        }