本文整理汇总了C#中Server.MirObjects.MonsterObject类的典型用法代码示例。如果您正苦于以下问题:C# MonsterObject类的具体用法?C# MonsterObject怎么用?C# MonsterObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MonsterObject类属于Server.MirObjects命名空间,在下文中一共展示了MonsterObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attacked
public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
{
int armour = 0;
switch (type)
{
case DefenceType.ACAgility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.AC:
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.MACAgility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinMAC, MaxMAC);
break;
case DefenceType.MAC:
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.Agility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
break;
}
if (MagicShield)
damage -= damage * (MagicShieldLv + 2) / 10;
if (armour >= damage) return 0;
MagicShieldTime -= (damage - armour) * 60;
LastHitter = attacker.Master ?? attacker;
LastHitTime = Envir.Time + 10000;
RegenTime = Envir.Time + RegenDelay;
DamageDura();
Enqueue(new S.Struck { AttackerID = attacker.ObjectID });
Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });
//
ChangeHP(armour - damage);
return damage - armour;
}
示例2: IsFriendlyTarget
public override bool IsFriendlyTarget(MonsterObject ally)
{
throw new NotSupportedException();
}
示例3: IsFriendlyTarget
public override bool IsFriendlyTarget(MonsterObject ally)
{
if (Master != null) return false;
if (ally.Race != ObjectType.Monster) return false;
if (ally.Master != null) return false;
return true;
}
示例4: IsAttackTarget
public override bool IsAttackTarget(MonsterObject attacker)
{
return false;
}
示例5: Attacked
public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
{
throw new NotSupportedException();
}
示例6: IsAttackTarget
public abstract bool IsAttackTarget(MonsterObject attacker);
示例7: Remove
public virtual void Remove(MonsterObject monster)
{
}
示例8: IsAttackTarget
public override bool IsAttackTarget(MonsterObject attacker)
{
if (attacker == null || attacker.Node == null) return false;
if (Dead || attacker.Master == this || GMGameMaster) return false;
if (attacker.Info.AI == 6 || attacker.Info.AI == 58) return PKPoints >= 200;
if (attacker.Master == null) return true;
if (InSafeZone || attacker.Master.InSafeZone) return false;
if (LastHitter != attacker.Master && attacker.Master.LastHitter != this)
{
bool target = false;
for (int i = 0; i < attacker.Master.Pets.Count; i++)
{
if (attacker.Master.Pets[i].Target != this) continue;
target = true;
break;
}
if (!target)
return false;
}
switch (attacker.Master.AMode)
{
case AttackMode.All:
return true;
case AttackMode.Group:
return GroupMembers == null || !GroupMembers.Contains(attacker.Master);
case AttackMode.Guild:
return true;
case AttackMode.EnemyGuild:
return false;
case AttackMode.Peace:
return false;
case AttackMode.RedBrown:
return PKPoints >= 200 || Envir.Time < BrownTime;
}
return true;
}
示例9: IsFriendlyTarget
public override bool IsFriendlyTarget(MonsterObject ally)
{
if (ally.Race != ObjectType.Monster) return false;
if (ally.Master == null) return false;
switch (ally.Master.Race)
{
case ObjectType.Player:
if (!ally.Master.IsFriendlyTarget(this)) return false;
break;
case ObjectType.Monster:
return false;
}
return true;
}
示例10: Add
public override void Add(MonsterObject monster)
{
Enqueue(monster.GetInfo());
monster.SendHealth(this);
}
示例11: ElectricShock
private void ElectricShock(MonsterObject target, UserMagic magic)
{
if (target == null || !target.IsAttackTarget(this)) return;
if (Envir.Random.Next(4 - magic.Level) > 0)
{
if (Envir.Random.Next(2) == 0) LevelMagic(magic);
return;
}
LevelMagic(magic);
if (target.Master == this)
{
target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
target.Target = null;
return;
}
if (Envir.Random.Next(2) > 0)
{
target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
target.Target = null;
return;
}
if (target.Level > Level + 2 || !target.Info.CanTame) return;
if (Envir.Random.Next(Level + 20 + magic.Level * 5) <= target.Level + 10)
{
if (Envir.Random.Next(5) > 0 && target.Master == null)
{
target.RageTime = Envir.Time + (Envir.Random.Next(20) + 10) * 1000;
target.Target = null;
}
return;
}
if (Pets.Count(t => !t.Dead) >= magic.Level + 2) return;
int rate = (int)(target.MaxHP / 100);
if (rate <= 2) rate = 2;
else rate *= 2;
if (Envir.Random.Next(rate) != 0) return;
//else if (Envir.Random.Next(20) == 0) target.Die();
if (target.Master != null)
{
target.SetHP(target.MaxHP / 10);
target.Master.Pets.Remove(target);
}
else if (target.Respawn != null)
{
target.Respawn.Count--;
Envir.MonsterCount--;
CurrentMap.MonsterCount--;
target.Respawn = null;
}
target.Master = this;
//target.HealthChanged = true;
target.BroadcastHealthChange();
Pets.Add(target);
target.Target = null;
target.RageTime = 0;
target.ShockTime = 0;
target.OperateTime = 0;
target.MaxPetLevel = (byte)(1 + magic.Level * 2);
target.Broadcast(new S.ObjectName { ObjectID = target.ObjectID, Name = target.Name });
}
示例12: Remove
public override void Remove(MonsterObject monster)
{
Enqueue(new S.ObjectRemove { ObjectID = monster.ObjectID });
}
示例13: Attacked
public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
{
if (Target == null && attacker.IsAttackTarget(this))
Target = attacker;
int armour = 0;
switch (type)
{
case DefenceType.ACAgility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.AC:
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.MACAgility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinMAC, MaxMAC);
break;
case DefenceType.MAC:
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.Agility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
break;
}
armour = (int)(armour * PoisonRate);
if (armour >= damage) return 0;
if (Target != this && attacker.IsAttackTarget(this))
Target = attacker;
ShockTime = 0;
if (attacker.Info.AI == 6)
EXPOwner = null;
else if (attacker.Master != null)
{
if (!Functions.InRange(attacker.CurrentLocation, attacker.Master.CurrentLocation, Globals.DataRange))
EXPOwner = null;
else
{
if (EXPOwner == null || EXPOwner.Dead)
EXPOwner = attacker.Master;
if (EXPOwner == attacker.Master)
EXPOwnerTime = Envir.Time + EXPOwnerDelay;
}
}
Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });
ChangeHP(armour - damage);
return damage - armour;
}
示例14: Attacked
public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
{
int armour = 0;
switch (type)
{
case DefenceType.ACAgility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.AC:
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.MACAgility:
if (Envir.Random.Next(Settings.MagicResistWeight) < MagicResist) return 0;
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
armour = GetAttackPower(MinMAC, MaxMAC);
break;
case DefenceType.MAC:
if (Envir.Random.Next(Settings.MagicResistWeight) < MagicResist) return 0;
armour = GetAttackPower(MinAC, MaxAC);
break;
case DefenceType.Agility:
if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
break;
}
if (Envir.Random.Next(100) < Reflect)
{
attacker.Attacked(this, damage, type, false);
CurrentMap.Broadcast(new S.ObjectEffect { ObjectID = ObjectID, Effect = SpellEffect.Reflect },CurrentLocation);
return 0;
}
if (MagicShield)
damage -= damage * (MagicShieldLv + 2) / 10;
if (armour >= damage) return 0;
MagicShieldTime -= (damage - armour) * 60;
LastHitter = attacker.Master ?? attacker;
LastHitTime = Envir.Time + 10000;
RegenTime = Envir.Time + RegenDelay;
DamageDura();
ActiveBlizzard = false;
Enqueue(new S.Struck { AttackerID = attacker.ObjectID });
Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });
//
ChangeHP(armour - damage);
return damage - armour;
}
示例15: Add
public virtual void Add(MonsterObject monster)
{
}