| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using Server.MirDatabase;
- using Server.MirEnvir;
- using S = ServerPackets;
- namespace Server.MirObjects.Monsters
- {
- public class DemonGuard : ZumaMonster
- {
- public uint RevivalCount;
- public int LifeCount;
- public long RevivalTime, DieTime;
- public override uint Experience
- {
- get { return Info.Experience * (100 - (25 * RevivalCount)) / 100; }
- }
- protected internal DemonGuard(MonsterInfo info)
- : base(info)
- {
- RevivalCount = 0;
- LifeCount = Envir.Random.Next(3);
- }
- protected override void Attack()
- {
- if (!Target.IsAttackTarget(this))
- {
- Target = null;
- return;
- }
- ShockTime = 0;
- ActionTime = Envir.Time + 300;
- AttackTime = Envir.Time + AttackSpeed;
- Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
- if (Envir.Random.Next(3) > 0)
- {
- Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation });
- int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
- if (damage == 0) return;
- DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
- ActionList.Add(action);
- }
- else
- {
- Broadcast(new S.ObjectAttack { ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1 });
- int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
- if (damage == 0) return;
- DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
- ActionList.Add(action);
- }
- }
- public override void Die()
- {
- DieTime = Envir.Time;
- RevivalTime = (4 + Envir.Random.Next(20)) * 1000;
- base.Die();
- }
- protected override void ProcessAI()
- {
- if (Dead && Envir.Time > DieTime + RevivalTime && RevivalCount < LifeCount)
- {
- RevivalCount++;
- int newhp = (int)(Stats[Stat.HP] * (100 - (25 * RevivalCount)) / 100);
- Revive(newhp, false);
- }
- base.ProcessAI();
- }
- }
- }
|