本文整理汇总了C#中MUDEngine.CharData.IsAffected方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.IsAffected方法的具体用法?C# CharData.IsAffected怎么用?C# CharData.IsAffected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.IsAffected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Capture
/// <summary>
/// Capture command - restrain another character.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Capture(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
Affect af = new Affect();
/* Check player's level and class, allow mobs to do this too */
if ((!ch.HasSkill("capture")))
{
ch.SendText("You couldn't capture a dead rat.\r\n");
return;
}
if (str.Length == 0)
{
victim = ch.Fighting;
if (!victim)
{
ch.SendText("Capture whom?\r\n");
return;
}
}
else /* argument supplied */
{
victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
if (ch.Fighting && ch.Fighting != victim)
{
ch.SendText("Take care of the person you are fighting first!\r\n");
return;
}
if (!ch.IsImmortal())
{
ch.WaitState(Skill.SkillList["capture"].Delay);
}
Object rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one);
if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
{
rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two);
if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
{
rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_three);
if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
{
rope = Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_four);
if (!rope || rope.ItemType != ObjTemplate.ObjectType.rope)
rope = null;
}
}
}
if (!rope)
{
ch.SendText("You must have some rope to tie someone up!\r\n");
return;
}
rope.RemoveFromWorld();
/* only appropriately skilled PCs and uncharmed mobs */
if ((ch.IsNPC() && !ch.IsAffected( Affect.AFFECT_CHARM))
|| (!ch.IsNPC() && MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["capture"] / 4))
{
victim.AffectStrip( Affect.AffectType.skill, "capture");
af.Value = "capture";
af.Type = Affect.AffectType.skill;
af.Duration = 3 + ((ch.Level) / 8);
af.SetBitvector(Affect.AFFECT_BOUND);
victim.AddAffect(af);
SocketConnection.Act("You have captured $M!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n has captured you!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n has captured $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else
{
SocketConnection.Act("You failed to capture $M. Uh oh!",
ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n tried to capture you! Get $m!",
ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n attempted to capture $N&n, but failed!",
ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
/* go for the one who wanted to fight :) */
if (ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM) && !victim.Fighting)
{
victim.AttackCharacter(ch.Master);
}
//.........这里部分代码省略.........
示例2: 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:
//.........这里部分代码省略.........
示例3: ReturnToLoad
public static void ReturnToLoad( CharData ch )
{
if( !ch || !ch.InRoom )
return;
if( ch.InRoom.Area != Room.GetRoom( ch.LoadRoomIndexNumber ).Area )
return;
Exit.Direction dir = FindPath( ch.InRoom.IndexNumber, ch.LoadRoomIndexNumber, ch, -40000, true );
if( dir == Exit.Direction.invalid )
{
return;
}
if( ch.InRoom.ExitData[ (int)dir ].HasFlag( Exit.ExitFlag.closed ) &&
!ch.IsAffected( Affect.AFFECT_PASS_DOOR ) && !ch.HasInnate( Race.RACE_PASSDOOR ) )
{
CommandType.Interpret(ch, "unlock " + dir.ToString());
CommandType.Interpret(ch, "open " + dir.ToString());
return;
}
ch.Move( dir );
if( !ch.InRoom )
{
string text = "Return_to_load: no ch._inRoom! Mob #" + ch.MobileTemplate.IndexNumber + ", _name: " +
ch.Name + ". Placing mob in limbo (mob.AddToRoom()).";
Log.Error( text, 0 );
ch.AddToRoom( Room.GetRoom( StaticRooms.GetRoomNumber("ROOM_NUMBER_LIMBO") ) );
ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_SPAM, 0, text);
return;
}
return;
}
示例4: Get
/// <summary>
/// Pick up an item.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Get(CharData ch, string[] str)
{
if( ch == null ) return;
Object container;
bool found;
Object obj;
if (ch.IsAffected(Affect.AFFECT_HOLD) || ch.IsAffected(Affect.AFFECT_MINOR_PARA))
{
ch.SendText("Try as you might, your body refuses to move!\r\n");
return;
}
/* Get type. */
if (str.Length == 0 || String.IsNullOrEmpty(str[0]))
{
ch.SendText("Get what?\r\n");
return;
}
if (str.Length < 2)
{
if (str[0] != "all" && MUDString.IsPrefixOf("all.", str[0]))
{
/* 'get obj' */
obj = Object.GetObjFromList(ch.InRoom.Contents, ch, str[0]);
if (obj == null)
{
SocketConnection.Act("I see no $T&n here.", ch, null, str[0], SocketConnection.MessageTarget.character);
return;
}
if (ch.CarryNumber + 1 > Limits.MAX_CARRY)
{
ch.SendText("You have your hands full.\r\n");
return;
}
Object.GetObject(ch, obj, null);
}
else
{
/* 'get all' or 'get all.obj' */
found = false;
for(int i = (ch.InRoom.Contents.Count - 1); i >= 0; i--)
{
Object iobj = ch.InRoom.Contents[i];
if (iobj.FlyLevel != ch.FlightLevel)
{
continue;
}
if ((str[0].Equals("all", StringComparison.CurrentCultureIgnoreCase) ||
MUDString.NameContainedIn(str[0].Substring(4), iobj.Name))
&& CharData.CanSeeObj(ch, iobj))
{
found = true;
if (ch.CarryNumber + 1 > Limits.MAX_CARRY)
{
ch.SendText("You have your hands full.\r\n");
return;
}
Object.GetObject(ch, iobj, null);
}
}
if (!found)
{
if (str[0].Equals("all", StringComparison.CurrentCultureIgnoreCase))
{
ch.SendText("You see nothing here.\r\n");
}
else
{
SocketConnection.Act("You see no $T&n here.", ch, null, str[0].Substring(4), SocketConnection.MessageTarget.character);
}
}
}
}
else
{
/* 'get ... container' */
if (!MUDString.StringsNotEqual(str[1], "all") || !MUDString.IsPrefixOf("all.", str[1]))
{
ch.SendText("That doesn't seem possible.\r\n");
return;
}
container = ch.GetObjHere(str[1]);
if (!container)
{
SocketConnection.Act("You don't see any $T&n here.", ch, null, str[1], SocketConnection.MessageTarget.character);
return;
//.........这里部分代码省略.........
示例5: Hide
/// <summary>
/// Hide yourself or an object.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Hide(CharData ch, string[] str)
{
if( ch == null ) return;
/* Check player's skill */
if (!ch.HasSkill("hide"))
{
if(str.Length != 0)
{
HideItem(ch, new[] { str[0] });
return;
}
ch.SendText("You're far too obvious to hide anywhere.\r\n");
return;
}
if (ch.Riding)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (ch.CurrentPosition <= Position.sleeping)
{
return;
}
ch.SendText("You attempt to hide.\r\n");
if (ch.IsAffected(Affect.AFFECT_HIDE))
{
ch.RemoveAffect(Affect.AFFECT_HIDE);
}
if (ch.CheckSkill("hide"))
{
ch.SetAffectBit(Affect.AFFECT_HIDE);
}
ch.WaitState(12);
return;
}
示例6: Enter
/// <summary>
/// Enter a portal.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Enter(CharData ch, string[] str)
{
if( ch == null ) return;
Room location;
bool ship = false;
if (str.Length == 0)
{
ch.SendText("Enter what?\r\n");
return;
}
if (ch.Fighting)
{
ch.SendText("Not while you're fighting!\r\n");
return;
}
Room original = ch.InRoom;
Object portal = Object.GetObjFromList(ch.InRoom.Contents, ch, str[0]);
if (!portal)
{
SocketConnection.Act("There is no $t in here.", ch, str[0], null, SocketConnection.MessageTarget.character);
return;
}
if (portal.ItemType != ObjTemplate.ObjectType.portal)
{
if (portal.ItemType != ObjTemplate.ObjectType.ship && portal.ItemType != ObjTemplate.ObjectType.vehicle)
{
ch.SendText("That's not a portal.\r\n");
return;
}
ship = true;
}
if (!ship)
{
if (Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_CLOSED))
{
ch.SendText("That portal is closed.\r\n");
return;
}
if (portal.Values[2] == 0)
{
SocketConnection.Act("$p&n has no power left.", ch, portal, null, SocketConnection.MessageTarget.character);
return;
}
if (!Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_NO_CURSED)
&& (ch.IsAffected( Affect.AFFECT_CURSE) ))
{
ch.SendText("Your deity has forsaken you.\r\n");
return;
}
location = Room.GetRoom(portal.Values[0]);
if (Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_BUGGY) && MUDMath.NumberPercent() < 5)
{
location = Movement.GetRandomRoom();
}
if (Macros.IsSet(portal.Values[3], ObjTemplate.PORTAL_RANDOM))
{
location = Movement.GetRandomRoom();
portal.Values[0] = location.IndexNumber;
}
if (!location)
{
ch.SendText("The target room for this portal does not exist.\r\n");
return;
}
if (location == original)
{
SocketConnection.Act("$p&n doesn't seem to go anywhere.", ch, portal, null, SocketConnection.MessageTarget.character);
return;
}
}
else
{
location = Room.GetRoom(portal.Values[1]);
if (!location)
{
ch.SendText("That boat is broken. You may not board it.\r\n");
return;
}
}
if (location.IsPrivate())
{
ch.SendText("There is no room for you on the other side.\r\n");
//.........这里部分代码省略.........
示例7: Aware
public static void Aware(CharData ch, string[] str)
{
if( ch == null ) return;
Affect af = new Affect();
if (ch.IsNPC())
return;
if (!ch.HasSkill("awareness"))
{
ch.SendText("Your general obliviousness prevents your use of this skill.\r\n");
return;
}
if (ch.IsAffected(Affect.AFFECT_SKL_AWARE))
{
ch.SendText("You are already about as tense as you can get.\r\n");
return;
}
ch.SendText("You try to become more aware of your surroundings.\r\n");
ch.PracticeSkill("awareness");
af.Value = "awareness";
af.Type = Affect.AffectType.skill;
af.Duration = (ch.Level / 3) + 3;
af.SetBitvector(Affect.AFFECT_SKL_AWARE);
ch.AddAffect(af);
return;
}
示例8: Worldmap
/// <summary>
/// Shows the world map. Can be called from the look command or called directly.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Worldmap(CharData ch, string[] str)
{
int x;
Room room;
if (ch.InRoom == null)
{
return;
}
if (!ch.InRoom.Area.HasFlag(Area.AREA_WORLDMAP))
{
return;
}
// TODO: Use Map.GetUnderdarkVisibilityModifier(racewarside) and Map.GetDaytimeVisibilityModifier(racewarside)
int visibility = 5 + (int)ch.FlightLevel;
// Godmode will make you see farther on the map.
if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_GODMODE))
{
visibility += 5;
}
int indexNumber = ch.InRoom.IndexNumber;
int startIndexNumber = ch.InRoom.Area.LowRoomIndexNumber;
int column = (indexNumber - startIndexNumber) % ch.InRoom.Area.Width;
int row = (indexNumber - startIndexNumber) / ch.InRoom.Area.Width;
if (visibility <= 0 && !ch.IsAffected(Affect.AFFECT_BLIND))
{
visibility = 1;
}
if (visibility > Limits.MAX_MAP_VISIBILITY)
{
visibility = Limits.MAX_MAP_VISIBILITY;
}
string mapSpaces = String.Empty;
string lineEnding = ":";
string mapClose = "</map>";
string text = "<map>";
string boundchar = " ";
bool graphicalClient = !ch.IsNPC() && ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED;
if (!graphicalClient)
{
boundchar = "&-L &n";
mapSpaces = " ";
lineEnding = "\r\n";
mapClose = "\r\n";
text = "\r\n";
}
for (x = (0 - Limits.MAX_MAP_VISIBILITY); x <= Limits.MAX_MAP_VISIBILITY; x++)
{
if (graphicalClient)
{
text += (x + Limits.MAX_MAP_VISIBILITY).ToString() + "|";
}
else if (x < (0 - visibility) || x > (visibility))
{
continue;
}
text += mapSpaces;
int y;
for (y = (0 - Limits.MAX_MAP_VISIBILITY); y <= Limits.MAX_MAP_VISIBILITY; y++)
{
if(x < (0 - visibility) || x > (visibility))
{
if (graphicalClient)
{
text += boundchar;
}
else
{
continue;
}
}
bool hasM = false;
bool hasP = false;
room = Room.GetRoom((indexNumber + ((x * ch.InRoom.Area.Width) + y)));
if (room && room.People.Count > 0)
{
foreach (CharData roomChar in room.People)
{
if ((roomChar.FlightLevel == ch.FlightLevel || ch.FlightLevel == roomChar.FlightLevel + 1) && CharData.CanSee(ch, roomChar))
{
if (roomChar.IsNPC())
{
if (roomChar.FlightLevel == ch.FlightLevel)
{
hasM = true;
}
else
//.........这里部分代码省略.........
示例9: Cast
/// <summary>
/// Command to cast a spell.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Cast(CharData ch, string[] str)
{
if( ch == null ) return;
if ((ch.IsClass(CharClass.Names.psionicist) || ch.IsClass(CharClass.Names.enslaver)) && !ch.IsImmortal())
{
ch.SendText("Psionicists use the WILL command to invoke their powers.\r\n");
return;
}
if (ch.IsClass(CharClass.Names.bard) && !ch.IsImmortal())
{
ch.SendText("Bards use the SING or PLAY commands to invoke their powers.\r\n");
return;
}
if (ch.Riding && ch.InRoom == ch.Riding.InRoom)
{
ch.SendText("You cannot cast while mounted!\r\n");
return;
}
if (ch.IsAffected( Affect.AFFECT_MINOR_PARA) ||
ch.IsAffected( Affect.AFFECT_HOLD))
{
ch.SendText("You can't cast when you're paralyzed!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Cast what spell where?\r\n");
return;
}
Magic.Cast(ch, String.Join(" ", str));
}
示例10: Wear
/// <summary>
/// Put on a piece of equipment.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Wear(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj;
if (ch.IsAffected(Affect.AFFECT_HOLD) || ch.IsAffected(Affect.AFFECT_MINOR_PARA))
{
ch.SendText("Your body refuses the call to movement.\r\n");
return;
}
if (!ch.IsNPC() && ch.IsAffected( Affect.AFFECT_WRAITHFORM))
{
ch.SendText("You try, but your &n&+wghoul&n form resists your attempts.\r\n");
return;
}
if (ch.Fighting || ch.CurrentPosition == Position.fighting)
{
ch.SendText("You can't wear stuff while you're fighting!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Wear, wield, or hold what?\r\n");
return;
}
if (str[0] == "all")
{
foreach (Object iobj in ch.Carrying)
{
if (iobj.WearLocation != ObjTemplate.WearLocation.none || !CharData.CanSeeObj(ch, iobj))
{
continue;
}
if (iobj.HasWearFlag(ObjTemplate.WEARABLE_WIELD)
&& !ch.HasInnate(Race.RACE_WEAPON_WIELD))
{
continue;
}
Object.WearObject(ch, iobj, false);
if (iobj.Trap != null && iobj.Trap.CheckTrigger( Trap.TriggerType.wear))
{
ch.SetOffTrap(iobj);
if (ch.CurrentPosition == Position.dead)
{
return;
}
}
}
return;
}
if (!(obj = ch.GetObjCarrying(str[0])))
{
ch.SendText("You do not have that item.\r\n");
return;
}
if (obj.HasWearFlag(ObjTemplate.WEARABLE_WIELD)
&& !ch.HasInnate(Race.RACE_WEAPON_WIELD))
{
ch.SendText("You are not able to wield a weapon.\r\n");
return;
}
Object.WearObject(ch, obj, true);
if (obj.Trap != null && obj.Trap.CheckTrigger( Trap.TriggerType.wear))
{
ch.SetOffTrap(obj);
if (ch.CurrentPosition == Position.dead)
{
return;
}
}
return;
}
示例11: Wield
/// <summary>
/// Equip a weapon. Now calls equip_hand to resolve the actual equipping
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Wield(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj;
if (ch.IsAffected(Affect.AFFECT_HOLD) || ch.IsAffected( Affect.AFFECT_MINOR_PARA))
{
ch.SendText("Your body refuses the call to movement.\r\n");
return;
}
if (!ch.IsNPC() && ch.IsAffected( Affect.AFFECT_WRAITHFORM))
{
ch.SendText("You try, but your &n&+wghoul&n form resists your attempts.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Wield what?\r\n");
return;
}
if (!(obj = ch.GetObjCarrying(str[0])))
{
ch.SendText("You do not have that item.\r\n");
return;
}
if (!obj.HasWearFlag(ObjTemplate.WEARABLE_WIELD))
{
if (obj.ItemType == ObjTemplate.ObjectType.weapon)
{
ch.SendText("That object is not usable as a weapon.\r\n");
return;
}
if (obj.ItemType == ObjTemplate.ObjectType.ranged_weapon && !obj.HasWearFlag(ObjTemplate.WEARABLE_HOLD))
{
ch.SendText("That object is not usable as a missile weapon.\r\n");
return;
}
if (obj.ItemType == ObjTemplate.ObjectType.ranged_weapon)
{
// Ranged weapons flagged wither wield or hold are fine to use -- Xangis
}
else
{
ch.SendText("That object is not a weapon.\r\n");
return;
}
}
if (!ch.HasInnate(Race.RACE_WEAPON_WIELD))
{
ch.SendText("You are not able to wield a weapon.\r\n");
return;
}
if (!obj.IsWearableBy(ch))
return;
Object.EquipInHand(ch, obj, Object.EQUIP_WIELD);
return;
}
示例12: 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;
}
示例13: Untangle
/// <summary>
/// Try to free someone who has been bound.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Untangle(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
if (!ch.IsNPC() && !ch.HasSkill("untangle"))
{
ch.SendText("You aren't nimble enough.\r\n");
return;
}
if (str.Length == 0)
{
victim = ch;
}
else
{
victim = ch.GetCharRoom(str[0]);
if (victim == null)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
if (!victim.HasAffect( Affect.AffectType.skill, "capture"))
{
ch.SendText("There's nothing to untangle.\r\n");
return;
}
if ((ch.IsNPC() && !ch.IsAffected( Affect.AFFECT_CHARM)) || (!ch.IsNPC()
&& MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["untangle"]))
{
victim.AffectStrip( Affect.AffectType.skill, "capture");
if (victim != ch)
{
SocketConnection.Act("You untangle $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n untangles you.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n untangles $n&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else
{
ch.SendText("You untangle yourself.\r\n");
SocketConnection.Act("$n&n untangles $mself.", ch, null, null, SocketConnection.MessageTarget.room);
}
ch.PracticeSkill("untangle");
return;
}
}
示例14: 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)
//.........这里部分代码省略.........
示例15: Eat
//.........这里部分代码省略.........
return;
}
if (str.Length == 0)
{
ch.SendText("Eat what?\r\n");
return;
}
if (!(obj = ch.GetObjCarrying(str[0])))
{
ch.SendText("You do not have that item.\r\n");
return;
}
if (!ch.IsImmortal())
{
if (obj.ItemType != ObjTemplate.ObjectType.food && obj.ItemType != ObjTemplate.ObjectType.pill)
{
ch.SendText("That's not edible.\r\n");
return;
}
if (!ch.IsNPC() && ((PC)ch).Hunger > 40)
{
ch.SendText("You are too full to eat more.\r\n");
return;
}
}
SocketConnection.Act("You consume $p&n.", ch, obj, null, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n inhales $p&n.", ch, obj, null, SocketConnection.MessageTarget.room);
switch (obj.ItemType)
{
case ObjTemplate.ObjectType.food:
if (!ch.IsNPC())
{
int condition = ((PC)ch).Hunger;
if (!ch.IsUndead())
{
ch.AdjustHunger(obj.Values[0]);
}
if (((PC)ch).Hunger > 40)
{
ch.SendText("You are full.\r\n");
}
else if (condition == 0 && ((PC)ch).Hunger > 0)
{
ch.SendText("You are no longer hungry.\r\n");
}
}
if (obj.Values[3] != 0 && !CharData.CheckImmune(ch, Race.DamageType.poison))
{
/* The shit was poisoned! */
Affect af = new Affect();
SocketConnection.Act("$n chokes and gags.", ch, null, null, SocketConnection.MessageTarget.room);
ch.SendText("You choke and gag.\r\n");
af.Type = Affect.AffectType.spell;
af.Value = "poison";
af.Duration = 2 * obj.Values[0];
af.AddModifier(Affect.Apply.strength, -(obj.Level / 7 + 2));
af.SetBitvector(Affect.AFFECT_POISON);
ch.CombineAffect(af);
}
break;
case ObjTemplate.ObjectType.pill:
{
for (int i = 1; i <= 4; i++)
{
String spellName = SpellNumberToTextMap.GetSpellNameFromNumber(obj.Values[i]);
if (String.IsNullOrEmpty(spellName))
{
Log.Error("Eat: Spell number " + obj.Values[i] + " not found for pill object " + obj.ObjIndexNumber + ". Make sure it's in the SpellNumberToTextMap.");
}
Spell spell = StringLookup.SpellLookup(spellName);
if (!spell)
{
Log.Error("Eat: Spell '" + spellName + "' not found for pill object " + obj.ObjIndexNumber + ". Make sure it's in the spells file.");
}
else
{
spell.Invoke(ch, obj.Values[0], ch);
}
}
}
break;
}
if (!ch.IsNPC() || (ch.IsNPC() && ch.IsAffected(Affect.AFFECT_CHARM)))
{
obj.RemoveFromWorld();
}
return;
}