本文整理汇总了C#中MUDEngine.CharData.RemoveAffect方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.RemoveAffect方法的具体用法?C# CharData.RemoveAffect怎么用?C# CharData.RemoveAffect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.RemoveAffect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TrackCommand
/// <summary>
/// Player track command.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void TrackCommand(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
if (ch.IsAffected(Affect.AFFECT_TRACK))
{
ch.SendText("You stop tracking.\r\n");
Combat.StopHunting(ch);
ch.RemoveAffect(Affect.AFFECT_TRACK);
return;
}
if (!ch.HasSkill("track"))
{
ch.SendText("You couldn't track an &+Lelephant&n in your own bedroom.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Whom are you trying to track?\r\n");
return;
}
if (ch.Riding)
{
ch.SendText("You can't sniff a trail mounted.\r\n");
return;
}
if (ch.FlightLevel != 0)
{
ch.SendText("You find tracks on the _ground_!\r\n");
return;
}
if (ch.InRoom.IsWater())
{
ch.SendText("You can't track through water.\r\n");
return;
}
if (ch.CurrentPosition != Position.standing)
{
if (ch.CurrentPosition == Position.fighting)
ch.SendText("You're too busy fighting .\r\n");
else
ch.SendText("You must be standing to track!\r\n");
return;
}
/* only imps can hunt to different areas */
bool area = (ch.GetTrust() < Limits.LEVEL_OVERLORD);
if (area)
{
victim = ch.GetCharInArea(str[0]);
}
else
{
victim = ch.GetCharWorld(str[0]);
}
if (!victim || (!victim.IsNPC() && (ch.IsRacewar(victim)) && !ch.IsImmortal()))
{
ch.SendText("You can't find a trail of anyone like that.\r\n");
return;
}
if (ch.InRoom == victim.InRoom)
{
SocketConnection.Act("You're already in $N&n's room!", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
/*
* Deduct some movement.
*/
if (ch.CurrentMoves > 2)
{
ch.CurrentMoves -= 3;
}
else
{
ch.SendText("You're too exhausted to hunt anyone!\r\n");
return;
}
SocketConnection.Act("$n carefully sniffs the air.", ch, null, null, SocketConnection.MessageTarget.room);
ch.WaitState(Skill.SkillList["track"].Delay);
Exit.Direction direction = Track.FindPath(ch.InRoom.IndexNumber, victim.InRoom.IndexNumber, ch, -40000, area);
if (direction == Exit.Direction.invalid)
//.........这里部分代码省略.........
示例2: Visible
/// <summary>
/// Lets a player go visible if they want to.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Visible(CharData ch, string[] str)
{
if( ch == null ) return;
if (!ch.IsAffected(Affect.AFFECT_INVISIBLE) && !ch.IsAffected(Affect.AFFECT_MINOR_INVIS) &&
!ch.IsAffected(Affect.AFFECT_DUERGAR_HIDE))
{
ch.SendText("You already stick out like a &+Rsore thumb&n.\r\n" );
return;
}
ch.RemoveAffect(Affect.AFFECT_INVISIBLE);
ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
ch.RemoveAffect(Affect.AFFECT_DUERGAR_HIDE);
ch.SendText("You make yourself visible.\r\n");
SocketConnection.Act("$n&n slowly fades into existence.\r\n", ch, null, null, SocketConnection.MessageTarget.room );
return;
}
示例3: Sneak
/// <summary>
/// Move silently.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Sneak(CharData ch, string[] str)
{
if( ch == null ) return;
/* Don't allow charmed mobs to do this, check player's skill */
if ((!ch.HasSkill("sneak")))
{
ch.SendText("You're about as sneaky as a buffalo in tap shoes.\r\n");
return;
}
if (ch.Riding)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (str.Length != 0 && !MUDString.StringsNotEqual(str[0], "off"))
{
if (!ch.IsAffected(Affect.AFFECT_SNEAK))
{
ch.SendText("You're not sneaking.\r\n");
}
else
{
ch.SendText("You stop sneaking around.\r\n");
ch.RemoveAffect(Affect.AFFECT_SNEAK);
}
return;
}
ch.SendText("You attempt to move silently.\r\n");
ch.RemoveAffect( Affect.AFFECT_SNEAK );
/* Check skill knowledge when moving only. */
Affect af = new Affect(Affect.AffectType.skill, "sneak", -1, Affect.Apply.none, 0, Affect.AFFECT_SNEAK);
ch.AddAffect(af);
ch.PracticeSkill("sneak");
ch.WaitState(10);
return;
}
示例4: Steal
//.........这里部分代码省略.........
return;
}
if (ch.Level < victim.Level)
{
// stealing from higher level is possible, but harder
percent -= 5 * (victim.Level - ch.Level);
}
else
{
// slight bonus for mobs lower level
percent += (ch.Level - victim.Level);
}
if (obj.WearLocation == ObjTemplate.WearLocation.none)
/* Items worn are harder */
percent = (int)(percent * .8);
else
percent = (int)(percent * .4);
}
ch.PracticeSkill("steal");
if (percent > 85)
percent = 85;
if (percent < 2)
percent = 2;
if (percent < MUDMath.NumberPercent())
{
/*
* Failure.
*/
//strip sneak
ch.RemoveAffect(Affect.AFFECT_SNEAK);
// chance of removing invis
if (ch.IsAffected(Affect.AFFECT_INVISIBLE) && MUDMath.NumberPercent() > percent)
{
ch.SendText("You really bungled that attempt.\r\n");
ch.RemoveAffect(Affect.AFFECT_INVISIBLE);
}
else
{
ch.SendText("Oops.\r\n");
}
SocketConnection.Act("$n&n tried to steal from $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
if (victim.IsAwake())
{
SocketConnection.Act("$n&n tried to steal from you!", ch, null, victim, SocketConnection.MessageTarget.victim);
}
else
{
sleeping = true;
}
// Thief flag for justice.
// Added so blind mobs dont hit who ever failed steal from em.
if (victim.IsNPC())
{
if (!sleeping && !victim.IsBlind())
{
CommandType.Interpret(victim, "kill " + ch.Name);
}
}
else
{
if (!victim.IsBlind() && !sleeping && victim.IsAffected(Affect.AFFECT_BERZERK))
{
示例5: FoundPrey
/// <summary>
/// Tracking mob has found the person its after. Attack or react accordingly.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void FoundPrey( CharData ch, CharData victim )
{
string victname = String.Empty;
string text = String.Empty;
string lbuf = String.Empty;
if (!victim)
{
Log.Error("FoundPrey: null victim", 0);
return;
}
if (!victim.InRoom)
{
Log.Error("FoundPrey: null victim._inRoom", 0);
return;
}
ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_HUNTING, 0, string.Format("{0}&n has found {1}.", ch.ShortDescription, victim.Name));
if (ch.IsAffected(Affect.AFFECT_TRACK))
{
ch.RemoveAffect(Affect.AFFECT_TRACK);
Combat.StopHunting(ch);
return;
}
if (ch.IsAffected(Affect.AFFECT_JUSTICE_TRACKER))
{
/* Give Justice the ability to ground flying culprits */
if (victim.FlightLevel != 0)
{
SocketConnection.Act("$n&n forces you to land!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n forces $N&n to land!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
victim.FlightLevel = 0;
}
SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n says, 'Stop, $N&n, you're under ARREST!'", ch, null, victim, SocketConnection.MessageTarget.room);
SocketConnection.Act("$n&n chains you up.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n binds $N&n so $E can't move.", ch, null, victim, SocketConnection.MessageTarget.room);
victim.SetAffectBit(Affect.AFFECT_BOUND);
victim.RemoveFromRoom();
if (ch.InRoom.Area.JailRoom != 0)
{
victim.AddToRoom(Room.GetRoom(victim.InRoom.Area.JailRoom));
}
else
{
victim.SendText("Justice is broken in this town - there is no jail and you're screwed.\r\n");
}
Combat.StopHunting(ch);
return;
}
victname = victim.IsNPC() ? victim.ShortDescription : victim.Name;
if (ch.FlightLevel != victim.FlightLevel)
{
if (ch.CanFly())
{
if (ch.FlightLevel < victim.FlightLevel && ch.FlightLevel < CharData.FlyLevel.high)
{
Command.Fly(ch, new string[] { "up" });
}
else
{
Command.Fly(ch, new string[] { "down" });
}
}
else
{
SocketConnection.Act("$n peers around looking for something.", ch, null, null, SocketConnection.MessageTarget.room);
}
return;
}
if (!CharData.CanSee(ch, victim))
{
if (MUDMath.NumberPercent() < 90)
return;
switch (MUDMath.NumberBits(5))
{
case 0:
text = String.Format("You can't hide forever, {0}!", victname);
Command.Say(ch, new string[]{text});
break;
case 1:
SocketConnection.Act("$n&n sniffs around the room.", ch, null, victim, SocketConnection.MessageTarget.room);
text = "I can smell your blood!";
Command.Say(ch, new string[]{text});
break;
case 2:
text = String.Format("I'm going to tear {0} apart!", victname);
Command.Yell(ch, new string[]{text});
break;
case 3:
//.........这里部分代码省略.........
示例6: Interpret
//.........这里部分代码省略.........
|| CommandTable[cmd].LoggingType == LogType.always)
{
string logBuf = String.Format("Log {0}: {1}", ch.Name, logline);
Log.Trace(logBuf);
ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SECURE, ch.GetTrust(), logBuf);
}
if (ch.Socket && ch.Socket.SnoopBy)
{
ch.Socket.SnoopBy.WriteToBuffer("% ");
ch.Socket.SnoopBy.WriteToBuffer(logline);
ch.Socket.SnoopBy.WriteToBuffer("\r\n");
}
// Break meditate
if (CommandTable[cmd].BreakMeditate)
{
if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
{
ch.RemoveActionBit(PC.PLAYER_MEDITATING);
ch.SendText("You stop meditating.\r\n");
}
}
// Break sneak, hide, and invis
// Anything that will break hide OR invis will break concealment
// This is DUMB! Breaks invis w/backstab on a target that's not
// there: i.e. "backstab trolll"/"backstab humann" . vis and no
// attack! - (Should be handled with make_vis function).
if (CommandTable[cmd].BreakInvisibility)
{
if (ch.IsAffected(Affect.AFFECT_INVISIBLE))
{
ch.RemoveAffect(Affect.AFFECT_INVISIBLE);
ch.RemoveAffect(Affect.AFFECT_HIDE);
ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
SocketConnection.Act("$n&n snaps into visibility.", ch, null, null, SocketConnection.MessageTarget.room);
ch.SendText("You snap into visibility.\r\n");
}
else if (ch.IsAffected(Affect.AFFECT_MINOR_INVIS))
{
ch.RemoveAffect(Affect.AFFECT_INVISIBLE);
ch.RemoveAffect(Affect.AFFECT_HIDE);
ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
ch.SendText("You appear.\r\n");
}
}
if (CommandTable[cmd].BreakHide)
{
if (ch.IsAffected(Affect.AFFECT_MINOR_INVIS))
{
ch.SendText("You appear.\r\n");
}
ch.AffectStrip( Affect.AffectType.skill, "shadow form");
ch.RemoveAffect( Affect.AFFECT_HIDE );
ch.RemoveAffect(Affect.AFFECT_MINOR_INVIS);
}
}
// Command was not found, respond accordingly.
else
{
// Look for command in socials table.
if (!Database.SocialList.CheckSocial(ch, command, argument))
示例7: KillingBlow
/// <summary>
/// Deliver a killing blow to the victim.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void KillingBlow( CharData ch, CharData victim )
{
Event eventdata;
Room room;
bool noCorpse = false;
StopFighting( victim, true );
if( victim.GroupLeader || victim.NextInGroup )
{
victim.RemoveFromGroup( victim );
}
if( ch != victim )
{
if( victim.IsNPC() && victim.MobileTemplate.DeathFun.Count > 0 )
{
victim.MobileTemplate.DeathFun[0].SpecFunction( victim, MobFun.PROC_NORMAL );
}
// prog_death_trigger( victim );
}
if( victim.IsNPC() && victim.DeathFunction != null )
{
noCorpse = victim.DeathFunction.SpecFunction( victim, MobFun.PROC_DEATH );
}
if( !noCorpse )
{
MakeCorpse( victim );
}
/* Strip all event-spells from victim! */
for( int i = (Database.EventList.Count - 1); i >= 0; i-- )
{
eventdata = Database.EventList[i];
if( eventdata.Type == Event.EventType.immolate || eventdata.Type == Event.EventType.acid_arrow )
{
if( (CharData)eventdata.Target2 == victim )
{
Database.EventList.Remove( eventdata );
}
}
}
if( victim.Rider )
{
SocketConnection.Act( "$n&n dies suddenly, and you topple to the &n&+yground&n.", victim, null, victim.Rider, SocketConnection.MessageTarget.victim );
victim.Rider.Riding = null;
victim.Rider.CurrentPosition = Position.resting;
victim.Rider = null;
}
if( victim.Riding )
{
SocketConnection.Act( "$n&n topples from you, &+Ldead&n.", victim, null, victim.Riding, SocketConnection.MessageTarget.victim );
victim.Riding.Rider = null;
victim.Riding = null;
}
if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_VAMP_BITE))
{
victim.SetPermRace( Race.RACE_VAMPIRE );
}
for (int i = (victim.Affected.Count - 1); i >= 0; i--)
{
/* Keep the ghoul affect */
if (!victim.IsNPC() && victim.IsAffected(Affect.AFFECT_WRAITHFORM))
{
continue;
}
victim.RemoveAffect(victim.Affected[i]);
}
if( victim.IsNPC() )
{
victim.MobileTemplate.NumberKilled++;
// This may invalidate the char list.
CharData.ExtractChar( victim, true );
return;
}
CharData.ExtractChar( victim, false );
//save corpses, don't wait til next save_corpse event
Database.CorpseList.Save();
// Character has died in combat, extract them to repop point and put
// them at the menu.
/*
* Pardon crimes once justice system is complete
*/
// This is where we send them to the menu.
victim.DieFollower( victim.Name );
if( victim.InRoom )
{
room = victim.InRoom;
//.........这里部分代码省略.........
示例8: Flee
//.........这里部分代码省略.........
ch.SendText("You give up when you realize there's nowhere to flee to.\r\n");
}
// Panicked people can flee when not fighting.
CharData victim = ch.Fighting;
if (!victim)
{
if (ch.CurrentPosition == Position.fighting)
{
ch.CurrentPosition = Position.standing;
}
}
if (ch.IsAffected(Affect.AFFECT_BERZERK))
{
ch.SendText("You can't flee, you're in a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!\r\n");
return;
}
if (ch.IsAffected( Affect.AFFECT_BOUND))
{
ch.SendText("You are bound! You can't move!\r\n");
SocketConnection.Act("$n&n tries to flee, but is tied up!",
ch, null, null, SocketConnection.MessageTarget.room);
return;
}
if (ch.IsAffected( Affect.AFFECT_HOLD) ||
ch.IsAffected( Affect.AFFECT_MINOR_PARA))
{
ch.SendText("You can't move!\r\n");
SocketConnection.Act("$n&n tries to flee, but $e can't move!",
ch, null, null, SocketConnection.MessageTarget.room);
return;
}
// You should almost always be able to flee when not fighting.
if (ch.CurrentPosition == Position.standing)
{
chances = 30;
}
else
{
chances = 6;
}
Room wasIn = ch.InRoom;
for (attempt = 0; attempt < chances; attempt++)
{
Exit exit;
Exit.Direction door = Database.RandomDoor();
if ((exit = wasIn.GetExit(door)) == null || !exit.TargetRoom
|| exit.TargetRoom == wasIn || exit.HasFlag(Exit.ExitFlag.closed)
|| (ch.IsNPC() && (Room.GetRoom(exit.IndexNumber).HasFlag(RoomTemplate.ROOM_NO_MOB)
|| (ch.HasActionBit(MobTemplate.ACT_STAY_AREA) && exit.TargetRoom.Area != ch.InRoom.Area))))
{
continue;
}
if (ch.Riding && ch.Riding.Fighting)
{
Combat.StopFighting(ch.Riding, true);
}
// Just to keep the damned messages from being wacky...
ch.SetAffectBit(Affect.AFFECT_IS_FLEEING);
ch.Move(door);
ch.RemoveAffect(Affect.AFFECT_IS_FLEEING);
if (ch.InRoom == wasIn)
{
break;
}
Room nowIn = ch.InRoom;
ch.InRoom = wasIn;
SocketConnection.Act("$n&n panics and attempts to flee...", ch, null, null, SocketConnection.MessageTarget.room, true);
string text;
if (ch.CheckSneak())
{
SocketConnection.Act("$n&n has fled!", ch, null, null, SocketConnection.MessageTarget.room);
}
else
{
text = String.Format("$n&n flees {0}ward.", door.ToString());
SocketConnection.Act(text, ch, null, null, SocketConnection.MessageTarget.room, true);
}
ch.InRoom = nowIn;
text = String.Format("You flee {0}ward!\r\n", door.ToString());
ch.SendText(text);
Combat.StopFighting(ch, true);
return;
}
SocketConnection.Act("$n&n tries to flee but can't make it out of here!", ch, null, null, SocketConnection.MessageTarget.room, true);
ch.SendText("&+WYour escape is blocked!\r\n");
return;
}
示例9: InflictDamage
/// <summary>
/// Inflict damage from a single hit. This could use some cleanup since it's way too unwieldy at more than 600 lines.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <param name="dam"></param>
/// <param name="skill"></param>
/// <param name="weapon"></param>
/// <param name="damType"></param>
/// <returns></returns>
public static bool InflictDamage(CharData ch, CharData victim, int dam, string skill, ObjTemplate.WearLocation weapon, AttackType.DamageType damType)
{
if (ch == null || victim == null)
{
return false;
}
Object obj;
bool critical = false;
if( victim.CurrentPosition == Position.dead || victim.Hitpoints < -10 )
{
return true;
}
/*
* Stop up any residual loopholes.
*/
if( ( dam > 1276 ) && ch.Level < Limits.LEVEL_AVATAR )
{
string text;
if (ch.IsNPC() && ch.Socket)
{
text = String.Format("Damage: {0} from {1} by {2}: > 1276 points with {3} damage type!",
dam, ch.Name, ch.Socket.Original.Name, skill);
}
else
{
text = String.Format("Damage: {0} from {1}: > 1276 points with {2} damage type!",
dam, ch.IsNPC() ? ch.ShortDescription : ch.Name, skill);
}
Log.Error( text, 0 );
dam = 1276;
}
// Remove memorization and meditation bits - Xangis
victim.BreakMeditate();
victim.BreakMemorization();
if (victim.IsAffected( Affect.AFFECT_MINOR_PARA))
{
SocketConnection.Act( "$n&n disrupts the magic preventing $N&n from moving.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
SocketConnection.Act( "You disrupt the magic preventing $N&n from moving.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "&+YYou can move again.&n", ch, null, victim, SocketConnection.MessageTarget.victim );
victim.RemoveAffect( Affect.AFFECT_MINOR_PARA );
}
bool immune = false;
if( victim != ch )
{
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
victim = CheckGuarding( ch, victim );
if( IsSafe( ch, victim ) )
return false;
// is_safe could wipe out victim, as it calls procs if a boss
// check and see that victim is still valid
if( victim == null )
return true;
Crime.CheckAttemptedMurder( ch, victim );
if( victim.CurrentPosition > Position.stunned )
{
if( !victim.Fighting )
SetFighting( victim, ch );
// Can't have prone people automatically stand
if( victim.CurrentPosition == Position.standing )
victim.CurrentPosition = Position.fighting;
if( !ch.Fighting )
SetFighting( ch, victim );
/*
* If NPC victim is following, ch might attack victim's master.
* No charm check here because charm would be dispelled from
* tanking mobile when combat ensues thus ensuring PC charmer is
* not harmed.
* Check for IsSameGroup wont work as following mobile is not
* always grouped with PC charmer
*
* Added a check for whether ch has switch skill. If not,
* much lower chancing of retargetting
*/
if( ch.IsNPC()
&& victim.IsNPC()
&& victim.Master
&& victim.Master.InRoom == ch.InRoom
&& MUDMath.NumberBits( 2 ) == 0 )
{
//.........这里部分代码省略.........
示例10: InflictSpellDamage
//.........这里部分代码省略.........
}
/*
* Stop up any residual loopholes.
*/
// 1275 is average damage from Akiaurn's Power Word
// I changed this to reflect that.
if( ( dam > 1275 ) && ch.Level < Limits.LEVEL_AVATAR && ch.GetRace() != Race.RACE_DRAGON )
{
string buf3;
if( ch.IsNPC() && ch.Socket )
buf3 = String.Format(
"Spell_Damage: {0} from {1} by {2}: > 1275 points with {3} spell!",
dam, ch.Name, ch.Socket.Original.Name, spell.Name );
else
buf3 = String.Format(
"Spell_Damage: {0} from {1}: > 1275 points with {2} spell!",
dam, ch.IsNPC() ? ch.ShortDescription : ch.Name, spell.Name );
Log.Error( buf3, 0 );
dam = 1275;
}
if (victim.IsAffected( Affect.AFFECT_MINOR_PARA)
&& !( victim.GetRace() == Race.RACE_FIRE_ELE && damType == AttackType.DamageType.fire )
&& !( victim.GetRace() == Race.RACE_WATER_ELE && damType == AttackType.DamageType.water )
&& !( victim.GetRace() == Race.RACE_EARTH_ELE && damType == AttackType.DamageType.earth )
&& !( victim.GetRace() == Race.RACE_AIR_ELE && damType == AttackType.DamageType.wind ) )
{
SocketConnection.Act( "$n&n disrupts the magic preventing $N&n from moving.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
SocketConnection.Act( "You disrupt the magic preventing $N&n from moving.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "&+YYou can move again.&n", ch, null, victim, SocketConnection.MessageTarget.victim );
victim.RemoveAffect( Affect.AFFECT_MINOR_PARA );
victim.AffectStrip( Affect.AffectType.spell, "earthen grasp" );
victim.AffectStrip( Affect.AffectType.spell, "greater earthen grasp");
}
bool immune = false;
if( victim != ch )
{
/*
* Certain attacks are forbidden.
* Most other attacks are returned.
*/
if( IsSafe( ch, victim ) )
return false;
// is_safe could wipe out victim, as it calls procs if a boss
// check and see that victim is still valid
if( !victim )
return true;
Crime.CheckAttemptedMurder( ch, victim );
if( victim.CurrentPosition > Position.stunned
&& !( victim.GetRace() == Race.RACE_FIRE_ELE && damType == AttackType.DamageType.fire )
&& !( victim.GetRace() == Race.RACE_WATER_ELE && damType == AttackType.DamageType.water )
&& !( victim.GetRace() == Race.RACE_EARTH_ELE && damType == AttackType.DamageType.earth )
&& !( victim.GetRace() == Race.RACE_AIR_ELE && damType == AttackType.DamageType.wind ) )
{
// Offensive spells engage victim if not fighting, and
// caster only if neither are fighting.
if( !victim.Fighting && victim.InRoom == ch.InRoom
&& victim.FlightLevel == ch.FlightLevel )
{
SetFighting( victim, ch );
if( !ch.Fighting )
示例11: StopFollower
public static void StopFollower( CharData ch )
{
if( !ch )
{
Log.Error("StopFollower called with no CH argument.\r\n", 0);
return;
}
if( !ch.Master )
{
Log.Error("StopFollower: null master.", 0);
return;
}
if( ch.IsAffected( Affect.AFFECT_CHARM ) )
{
ch.RemoveAffect(Affect.AFFECT_CHARM);
ch.AffectStrip( Affect.AffectType.spell, "domination");
}
if( ch.Master != ch && CanSee( ch.Master, ch ) && ch.Master.InRoom )
SocketConnection.Act( "$n&n stops following you.", ch, null, ch.Master, SocketConnection.MessageTarget.victim );
if( ch.InRoom )
SocketConnection.Act( "You stop following $N&n.", ch, null, ch.Master, SocketConnection.MessageTarget.character );
// Remove the follower from the list of followers
foreach( CharData follower in ch.Master.Followers )
{
if( follower == ch )
{
ch.Master.Followers.Remove( follower );
}
}
ch.Master = null;
return;
}
示例12: ExtractChar
/// <summary>
/// Extracts a character from the world. If delete is true, it then deletes that character.
/// </summary>
/// <param name="ch"></param>
/// <param name="delete"></param>
public static void ExtractChar( CharData ch, bool delete )
{
if( ch == null )
{
Log.Error( "ExtractChar: null ch.", 0 );
return;
}
try
{
if (ch.Fighting)
{
Combat.StopFighting(ch, true);
}
Magic.ForgetAllSpells(ch);
Event.DeleteAttachedEvents(ch);
// Remove any affects we want to be gone next time they log in.
ch.RemoveAffect(Affect.AFFECT_CASTING);
ch.RemoveAffect(Affect.AFFECT_SINGING);
// Meaning they're dead for good or have left the game.
if (delete)
{
string name;
if (ch.IsNPC())
{
name = ch.ShortDescription;
}
else
{
name = ch.Name;
}
ch.DieFollower(name);
if (ch.GroupLeader || ch.NextInGroup)
{
ch.RemoveFromGroup(ch);
}
/* Get rid of weapons _first_ */
{
Object obj3 = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
Object obj2 = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
if (obj3 != null)
{
obj3.RemoveFromWorld();
}
/* Now kill obj2 if it exists no matter if on body or floor */
if (obj2)
{
obj2.RemoveFromWorld();
}
}
for (int i = ch.Carrying.Count - 1; i >= 0; --i)
{
ch.Carrying[i].RemoveFromWorld();
}
}
CharData worldChar;
for (int xx = Database.CharList.Count - 1; xx >= 0; xx--)
{
worldChar = Database.CharList[xx];
if (worldChar.ReplyTo == ch)
{
worldChar.ReplyTo = null;
}
if (worldChar.IsConsenting(ch))
{
worldChar.StopConsenting(ch);
SocketConnection.Act("You stop consenting $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
}
if (worldChar.IsIgnoring(ch))
{
worldChar.StopIgnoring(ch);
SocketConnection.Act("You stop ignoring $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
}
if (!worldChar.IsNPC() && ((PC)worldChar).Guarding == ch)
{
((PC)worldChar).Guarding = null;
SocketConnection.Act("You stop guarding $N&n.", worldChar, null, ch, SocketConnection.MessageTarget.character);
}
if (worldChar.IsHating(ch))
worldChar.StopHating(ch);
if (worldChar.Hunting && worldChar.Hunting.Who == ch)
Combat.StopHunting(worldChar);
if (worldChar.Fearing && worldChar.Fearing.Who == ch)
//.........这里部分代码省略.........
示例13: FinishSpell
/// <summary>
/// When a spell event terminates, we need something to happen.
///
/// By this point we should have terminated the spell/song event data
/// and should only need the info about the character and the spell
/// and the argument(s).
///
/// Passing of the correct function parameters should be handled by the
/// event system.
/// </summary>
/// <param name="ch">The caster</param>
/// <param name="spell">The spell number</param>
/// <param name="target">The _targetType</param>
public static void FinishSpell( CharData ch, Spell spell, Target target )
{
Object obj;
int chance = 0;
bool found = false;
string lbuf = String.Format("Magic.FinishSpell: {0} by {1}", spell.Name, ch.Name);
Log.Trace( lbuf );
for( int i = Database.CastList.Count - 1; i >= 0; i--)
{
if (Database.CastList[i].Who && Database.CastList[i].Who == ch)
{
Database.CastList.RemoveAt( i );
}
}
// If they're not casting at the end of the song or spell
// they certainly can't finish it.
if( ch.IsAffected( Affect.AFFECT_CASTING ) )
ch.RemoveAffect( Affect.AFFECT_CASTING );
else
{
return;
}
if( !ch.CheckConcentration(spell) )
return;
if( ( ch.IsAffected( Affect.AFFECT_MUTE ) || ch.HasInnate( Race.RACE_MUTE ) )
&& !ch.IsClass( CharClass.Names.psionicist ) )
{
ch.SendText( "Your lips move but no sound comes out.\r\n" );
return;
}
// Make sure the room is still castable.
if( !ch.InRoom.CheckCastable( ch, false, false ) )
return;
if( ch.InRoom.CheckStarshell( ch ) )
return;
MemorizeData memorized = null;
if (!ch.IsNPC() && !ch.IsImmortal() && !ch.IsClass(CharClass.Names.psionicist))
{
foreach( MemorizeData mem in ((PC)ch).Memorized )
{
if( !mem.Memmed )
continue;
if( mem.Name == spell.Name )
{
found = true;
memorized = mem;
break;
}
}
if (!found && !ch.IsNPC() && !ch.IsClass(CharClass.Names.psionicist))
{
ch.SendText( "You do not have that spell memorized!\r\n" );
if( spell.ValidTargets == TargetType.objectOrCharacter )
target = null;
else if( spell.ValidTargets == TargetType.none )
target = null;
return;
}
}
if( ch.IsAffected( Affect.AFFECT_FEEBLEMIND ) )
{
ch.SendText( "You are just too stupid to cast that spell!\r\n" );
SocketConnection.Act( "$n&n screws up $s face in concentration.", ch, null, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "$n&n tries really, really hard to complete a spell, but fails.", ch, null, null, SocketConnection.MessageTarget.room );
return;
}
// Locate targets.
CharData victim = null;
switch( spell.ValidTargets )
{
default:
Log.Trace( "FinishSpell: bad TargetType for spell {1}.", spell );
return;
case TargetType.objectOrCharacter:
if( ch.IsAffected( Affect.AFFECT_BLIND ) )
{
//.........这里部分代码省略.........
示例14: Chameleon
public static void Chameleon(CharData ch, string[] str)
{
if( ch == null ) return;
if (!ch.IsNPC() && !ch.HasSkill("chameleon power"))
{
ch.SendText("You don't know how to act like a chameleon.\r\n");
return;
}
ch.SendText("You attempt to blend in with your surroundings.\r\n");
if (ch.IsAffected(Affect.AFFECT_HIDE))
{
ch.RemoveAffect(Affect.AFFECT_HIDE);
}
if (ch.CheckSkill("chameleon power"))
{
ch.SetAffectBit(Affect.AFFECT_HIDE);
}
return;
}
示例15: SetFighting
/// <summary>
/// Set ch as fighting victim.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
public static void SetFighting( CharData ch, CharData victim )
{
if( ch == victim )
return;
if( ch.Fighting )
{
Log.Error( "Set_fighting: already fighting", 0 );
string buf = String.Format( "...{0} attacking {1} at {2}",
( ch.IsNPC() ? ch.ShortDescription : ch.Name ),
( victim.IsNPC() ? victim.ShortDescription : victim.Name ),
victim.InRoom.IndexNumber );
Log.Error( buf, 0 );
return;
}
if (ch.IsAffected(Affect.AFFECT_SLEEP))
{
ch.RemoveAffect(Affect.AFFECT_SLEEP);
}
if( ch.FlightLevel != victim.FlightLevel )
{
StartGrudge( ch, victim, false );
return;
}
ch.Fighting = victim;
if( ch.CurrentPosition == Position.standing )
ch.CurrentPosition = Position.fighting;
return;
}