| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using System.Drawing;
- using Server.MirDatabase;
- using Server.MirEnvir;
- using S = ServerPackets;
- namespace Server.MirObjects.Monsters
- {
- public class ManectricBlest : MonsterObject
- {
- private int _attackCount = 0;
- protected internal ManectricBlest(MonsterInfo info)
- : base(info)
- {
- }
- protected override void Attack()
- {
- if (!Target.IsAttackTarget(this))
- {
- Target = null;
- return;
- }
- Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
- if(_attackCount >= 5)
- {
- Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2 });
- int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
- List<MapObject> targets = FindAllTargets(3, CurrentLocation);
- for (int i = 0; i < targets.Count; i++)
- {
- targets[i].Attacked(this, damage, DefenceType.MAC);
- //TODO - Delay this
- if (Envir.Random.Next(Settings.PoisonResistWeight) >= targets[i].Stats[Stat.PoisonResist])
- {
- if (Envir.Random.Next(5) == 0)
- {
- targets[i].ApplyPoison(new Poison { PType = PoisonType.Frozen, Duration = 5, TickSpeed = 1000 }, this);
- }
- }
- }
- _attackCount = 0;
- return;
- }
- switch (Envir.Random.Next(3))
- {
- case 0:
- case 1:
- _attackCount++;
- base.Attack();
- break;
- case 2:
- {
- int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
- Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
- MirDirection dir = Functions.PreviousDir(Direction);
- Point tar;
- Cell cell;
- for (int i = 0; i < 8; i++)
- {
- tar = Functions.PointMove(CurrentLocation, dir, 1);
- dir = Functions.NextDir(dir);
- if (tar == Front) continue;
- if (!CurrentMap.ValidPoint(tar)) continue;
- cell = CurrentMap.GetCell(tar);
- if (cell.Objects == null) continue;
- for (int o = 0; o < cell.Objects.Count; o++)
- {
- MapObject ob = cell.Objects[o];
- if (ob.Race != ObjectType.Player && ob.Race != ObjectType.Monster) continue;
- if (!ob.IsAttackTarget(this)) continue;
- ob.Attacked(this, damage, DefenceType.Agility);
- break;
- }
- }
- break;
- }
- }
- ActionTime = Envir.Time + 300;
- AttackTime = Envir.Time + AttackSpeed;
- ShockTime = 0;
- }
-
- }
- }
|