示例#1
0
        void HealingPlayersPoison(World world, Player player, ActivateEffect eff)
        {
            var remainingHeal = eff.TotalDamage;
            var perHeal       = eff.TotalDamage * 1000 / eff.DurationMS;

            WorldTimer tmr = null;
            var        x   = 0;

            Func <World, RealmTime, bool> healTick = (w, t) =>
            {
                if (player.Owner == null || w == null)
                {
                    return(true);
                }

                if (x % 4 == 0) // make sure to change this if timer delay is changed
                {
                    var thisHeal = perHeal;
                    if (remainingHeal < thisHeal)
                    {
                        thisHeal = remainingHeal;
                    }

                    List <Packet> pkts = new List <Packet>();

                    Player.ActivateHealHp(player, thisHeal, pkts);
                    w.BroadcastPackets(pkts, null);
                    remainingHeal -= thisHeal;
                    if (remainingHeal <= 0)
                    {
                        return(true);
                    }
                }
                x++;

                tmr.Reset();
                return(false);
            };

            tmr = new WorldTimer(250, healTick);
            world.Timers.Add(tmr);
        }
示例#2
0
 public override void Tick(RealmTime time)
 {
     if (t / 500 == p2)
     {
         Owner.BroadcastPacket(new ShowEffectPacket
         {
             EffectType = EffectType.Trap,
             Color      = new ARGB(0xffd700),
             TargetId   = Id,
             PosA       = new Position {
                 X = radius
             }
         }, null);
         p2++;
         //Stuff
     }
     if (t / 2000 == p)
     {
         var pkts = new List <Packet>();
         BehaviorBase.AOE(Owner, this, radius, true,
                          player => { Player.ActivateHealHp(player as Player, amount, pkts); });
         pkts.Add(new ShowEffectPacket
         {
             EffectType = EffectType.AreaBlast,
             TargetId   = Id,
             Color      = new ARGB(0xffd700),
             PosA       = new Position {
                 X = radius
             }
         });
         Owner.BroadcastPackets(pkts, null);
         p++;
     }
     t += time.thisTickTimes;
     base.Tick(time);
 }