示例#1
0
        public static void StealLifeDamages(Fight fight, Fighter caster, List <Fighter> targets, Engines.Spells.SpellEffect effect, int element)
        {
            int damages    = 0;
            int effectBase = effect.Value3;

            if (effect.Value > 0 && effect.Value2 > 0)
            {
                effectBase = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3);
            }
            damages = RandomDamages(effectBase, caster, element);
            int takenDamages = (-damages);
            int stealedLife  = (int)Math.Truncate((double)(damages / 2));

            foreach (Fighter target in targets)
            {
                target.TakeDamages(target.ID, takenDamages, element);
                caster.Heal(caster.ID, stealedLife, element);
            }
            caster.UnInvisible();
        }
示例#2
0
        public void UseWeapon(Fighter fighter, int cellID)
        {
            if (fighter.Character.Items.GetItemAtPos(1) != null)
            {
                fighter.Send("GAS" + fighter.ID);

                Database.Records.WorldItemRecord item = fighter.Character.Items.GetItemAtPos(1);

                bool failedHit = false;

                if (Utilities.Basic.Rand(0, item.GetTemplate.Engine.TauxEC) == 1)
                {
                    failedHit = true;
                }

                if (!failedHit)
                {
                    if (fighter.CurrentAP >= item.Engine.CostInPa)
                    {
                        fighter.CurrentAP -= item.Engine.CostInPa;

                        bool criticatHit = false;
                        int tauxCC = item.Engine.TauxCC - fighter.Character.Stats.CriticalBonus.Total;
                        if (tauxCC < 2) tauxCC = 2;

                        if (Utilities.Basic.Rand(0, tauxCC) == 1)
                        {
                            criticatHit = true;
                        }

                        if (fighter.Client.Action.GodMode)
                        {
                            criticatHit = true;
                        }

                        this.Send("GA;303;" + fighter.ID + ";" + cellID);
                        List<Fighter> targets = GetFighterInZoneForWeapon(fighter, item.GetTemplate.Type, cellID);
                        foreach (Fighter target in targets)
                        {
                            foreach (World.Handlers.Items.Effect effect in item.Engine.Effects)
                            {
                                if (item.Engine.IsWeaponEffect(effect.ID))
                                {
                                    int baseDamage = 0;
                                    if (criticatHit)
                                    {
                                        this.Send("GA;301;" + fighter.ID + ";");
                                        baseDamage = Utilities.Basic.Rand(effect.Des.Min, effect.Des.Max);
                                    }
                                    else
                                    {
                                        baseDamage = Utilities.Basic.Rand(effect.Des.Min, effect.Des.Max);
                                    }
                                    if (GetElementForEffect(effect.ID) != 0)
                                    {
                                        int damages = FightSpellEffects.RandomDamages(baseDamage, fighter, GetElementForEffect(effect.ID));
                                        target.TakeDamages(target.ID, -damages, GetElementForEffect(effect.ID));
                                    }
                                    else if(GetStealElementForEffect(effect.ID) != 0)
                                    {
                                        int damages = FightSpellEffects.RandomDamages(baseDamage, fighter, GetStealElementForEffect(effect.ID));
                                        int stealedLife = (int)Math.Truncate((double)(damages / 2));
                                        target.TakeDamages(target.ID, -damages, GetStealElementForEffect(effect.ID));
                                        fighter.Heal(fighter.ID, stealedLife, GetStealElementForEffect(effect.ID));
                                    }
                                }
                            }
                        }
                    }
                    this.Send("GA;102;" + fighter.ID + ";" + fighter.ID + ",-" + item.Engine.CostInPa);
                }
                this.Send("GAF0|" + fighter.ID);
            }
        }
示例#3
0
 public static void StealLifeDamages(Fight fight, Fighter caster, List<Fighter> targets, Engines.Spells.SpellEffect effect, int element)
 {
     int damages = 0;
     int effectBase = effect.Value3;
     if (effect.Value > 0 && effect.Value2 > 0)
     {
         effectBase = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3);
     }
     damages = RandomDamages(effectBase, caster, element);
     int takenDamages = (-damages);
     int stealedLife = (int)Math.Truncate((double)(damages / 2));
     foreach (Fighter target in targets)
     {
         target.TakeDamages(target.ID, takenDamages, element);
         caster.Heal(caster.ID, stealedLife, element);
     }
     caster.UnInvisible();
 }