| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- using Server.MirDatabase;
- namespace Server.MirObjects.Monsters
- {
- public class EvilMirBody : MonsterObject
- {
- private bool _dragonlink;
- public bool DragonLink
- {
- get { return _dragonlink && Envir.DragonSystem != null; }
- set
- {
- if (_dragonlink == value) return;
- _dragonlink = value;
- }
- }
- protected override bool CanAttack { get { return false; } }
- protected override bool CanMove { get { return false; } }
- protected internal EvilMirBody(MonsterInfo info)
- : base(info)
- {
- DragonLink = true;
- }
- public override void Turn(MirDirection dir)
- {
- }
- public override bool Walk(MirDirection dir) { return false; }
- protected override void ProcessRoam() { }
- protected override void ProcessSearch() { }
- public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
- {
- if (DragonLink)
- {
- if (Envir.DragonSystem.LinkedMonster != null)
- {
- MonsterObject ob = Envir.DragonSystem.LinkedMonster;
- if (attacker.Info.AI == 6)
- EXPOwner = null;
- else if (attacker.Master != null)
- {
- if (!Functions.InRange(attacker.CurrentLocation, attacker.Master.CurrentLocation, Globals.DataRange))
- ob.EXPOwner = null;
- else
- {
- if (ob.EXPOwner == null || ob.EXPOwner.Dead)
- ob.EXPOwner = attacker.Master switch
- {
- HeroObject hero => hero.Owner,
- _ => attacker.Master
- };
- if (ob.EXPOwner == attacker.Master)
- ob.EXPOwnerTime = Envir.Time + EXPOwnerDelay;
- }
- }
- }
- Envir.DragonSystem.GainExp(Envir.Random.Next(1, 40));
- return 1;
- }
- return 0;
- }
- public override int Attacked(HumanObject attacker, int damage, DefenceType type = DefenceType.ACAgility, bool damageWeapon = true)
- {
- if (DragonLink)
- {
- if (Envir.DragonSystem.LinkedMonster != null)
- {
- MonsterObject ob = Envir.DragonSystem.LinkedMonster;
- if (ob.EXPOwner == null || ob.EXPOwner.Dead)
- ob.EXPOwner = GetAttacker(attacker);
- if (ob.EXPOwner == attacker)
- ob.EXPOwnerTime = Envir.Time + EXPOwnerDelay;
- }
- if (damageWeapon)
- attacker.DamageWeapon();
- Envir.DragonSystem.GainExp(Envir.Random.Next(1, 40));
- return 1;
- }
- return 0;
- }
- public override int Struck(int damage, DefenceType type = DefenceType.ACAgility)
- {
- return 0;
- }
- }
- }
|