本文整理汇总了C#中MUDEngine.CharData.GetCharRoom方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.GetCharRoom方法的具体用法?C# CharData.GetCharRoom怎么用?C# CharData.GetCharRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.GetCharRoom方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Buy
/// <summary>
/// Purchase something in a shop.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Buy(CharData ch, string[] str)
{
if( ch == null ) return;
string arg2 = String.Empty;
string arg3 = String.Empty;
string text;
bool fPerm = false;
if (str.Length == 0)
{
ch.SendText("Buy what?\r\n");
return;
}
if (ch.InRoom.HasFlag(RoomTemplate.ROOM_PET_SHOP))
{
if (ch.IsNPC())
return;
Room nextRoom = Room.GetRoom(ch.InRoom.IndexNumber + 1);
if (nextRoom == null)
{
Log.Error("Buy: bad pet shop at index number {0}.", ch.InRoom.IndexNumber);
ch.SendText("Sorry, you can't buy that here.\r\n");
return;
}
Room inRoom = ch.InRoom;
ch.InRoom = nextRoom;
CharData pet = ch.GetCharRoom(str[0]);
ch.InRoom = inRoom;
if (pet && ch.MaxPets())
{
ch.SendText("Sorry, you can't keep track of that many pets.\r\n");
return;
}
if (pet == null || !pet.HasActionBit(MobTemplate.ACT_PET))
{
ch.SendText("Sorry, you can't buy that here.\r\n");
return;
}
// Altered Pricing to match the ones that were given in the list
// command below... original was set to 500 * pet.level * pet.level
// Xangis tweaked it to 100 * pet level squared
if (ch.GetCash() < ((100 * pet.Level) * pet.Level))
{
ch.SendText("You can't afford it.\r\n");
return;
}
ch.SpendCash(((100 * pet.Level) * pet.Level));
pet = Database.CreateMobile(pet.MobileTemplate);
pet.SetActionBit(MobTemplate.ACT_PET);
pet.SetActionBit(MobTemplate.ACT_NOEXP);
pet.SetAffectBit(Affect.AFFECT_CHARM);
if (!String.IsNullOrEmpty(str[0]))
{
text = String.Format("{0} {1}", pet.Name, str[0]);
pet.Name = text;
}
text = String.Format("{0}&+LA neck tag says '&+RI belong to {1}&+L'.&n\r\n",
pet.Description, ch.Name);
pet.Description = text;
pet.AddToRoom(ch.InRoom);
CharData.AddFollower(pet, ch);
ch.SendText("Enjoy your pet.\r\n");
SocketConnection.Act("$n&n just purchased $N&n.", ch, null, pet, SocketConnection.MessageTarget.room);
return;
}
ObjTemplate objTemplate;
Object obj = null;
CharData keeper;
int itemCount = 1; /* buy only one by default */
if (MUDString.IsNumber(str[0]))
{
Int32.TryParse(str[0], out itemCount);
str[0] = arg2;
arg2 = arg3;
}
if (!(keeper = ch.FindShopkeeper(arg2)))
{
return;
}
if (!ch.IsNPC())
{
// Won't sell to bottom 25% of faction range.
//.........这里部分代码省略.........
示例2: Bandage
/// <summary>
/// Bandage someone's wounds.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Bandage(CharData ch, string[] str)
{
if( ch == null ) return;
if (ch.IsNPC() || !ch.HasSkill("bandage"))
{
ch.SendText("You don't know how to bandage!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Bandage whom?\r\n");
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (victim == null)
{
ch.SendText("They're not here.\r\n");
return;
}
if (victim.Hitpoints > 0)
{
ch.SendText("They do not need your help.\r\n");
return;
}
int chance = ((PC)ch).SkillAptitude["bandage"];
if (ch.IsClass(CharClass.Names.cleric))
chance += 4;
else if (ch.IsClass(CharClass.Names.antipaladin))
chance -= 4;
/* Don't allow someone doing more than 1 pt. of damage with bandage. */
int change = (Math.Max(chance - MUDMath.NumberPercent(), -1) / 20) + 1;
// Bandage is rarely used, make it likely to increase
ch.PracticeSkill("bandage");
ch.PracticeSkill("bandage");
ch.PracticeSkill("bandage");
ch.WaitState(Skill.SkillList["bandage"].Delay);
if (change < 0)
{
ch.SendText("You just made the problem worse!\r\n");
SocketConnection.Act("$n&n tries bandage you but your condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n tries bandage $N&n but $S condition only worsens.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else if (change > 0)
{
ch.SendText("You manage to fix them up a _bitvector.\r\n");
SocketConnection.Act("$n&n bandages you.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n bandages $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
else
{
ch.SendText("Your bandaging attempt had no effect.\r\n");
SocketConnection.Act("$n&n tries to bandage you but the wounds are too great.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n tries to bandage $N&n but is unable to have any effect.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
}
victim.Hitpoints += change;
victim.UpdatePosition();
return;
}
示例3: Headbutt
/*
* Modified to up the damage and allow for a
* chance to stun victim or self
* damage = (level) d2, for an average of 75 hp at level 50
* stun damage = (level) d3, for an average of 100 hp at level 50
* Player vs player damage is reduced in damage()
*/
/// <summary>
/// Headbutt. Usable to initiate combat and during combat.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Headbutt(CharData ch, string[] str)
{
if( ch == null ) return;
int chance;
int ko;
string text;
/* Check player's level and class, mobs can use this skill */
if ((!ch.HasSkill("headbutt")))
{
ch.SendText("Your skull is much too soft to headbutt anyone.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
{
ch.SendText("They are nowhere to be seen.\r\n");
return;
}
}
else
{
if (!victim || victim.CurrentPosition == Position.dead)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
}
/* anti headbutt me code */
if (ch == victim)
{
ch.SendText("You get dizzy as you ponder the mechanics of headbutting yourself.\r\n");
return;
}
if (ch.CurrentPosition < Position.fighting)
{
ch.SendText("You need to stand up to do that.\r\n");
return;
}
/* Check size of ch vs. victim. */
/* If ch is too small. */
/* Made it 2 sizes */
if (ch.CurrentSize - 2 > victim.CurrentSize)
{
SocketConnection.Act("You would crush such a small and delicate being with your mass.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
/* Ch 2 or more sizes larger than victim => bad! */
if (ch.CurrentSize + 1 < victim.CurrentSize)
{
SocketConnection.Act("You can't reach their head!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n slams $s head into your thigh.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n slams $s head into $N's thigh.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
ch.WaitState((Skill.SkillList["headbutt"].Delay * 9) / 10);
if (victim.Fighting == null)
{
Combat.SetFighting(victim, ch);
}
return;
}
ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["headbutt"].Delay));
ch.PracticeSkill("headbutt");
if (!ch.Fighting)
{
Combat.SetFighting(ch, victim);
}
if (!victim.Fighting)
{
Combat.SetFighting(victim, ch);
}
/* Added a PC skill level
*/
//.........这里部分代码省略.........
示例4: Backstab
/// <summary>
/// Stab someone in the back.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Backstab(CharData ch, string[] str)
{
if( ch == null ) return;
if (!ch.HasSkill("backstab"))
{
ch.SendText("You better leave the assassination trade to those more skilled.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
if (ch.Riding)
{
ch.SendText("You can't get close enough while mounted.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Backstab whom?\r\n");
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("They aren't here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("How can you sneak up on yourself?\r\n");
return;
}
Combat.Backstab(ch, victim);
return;
}
示例5: Glance
public static void Glance(CharData ch, string[] str)
{
if( ch == null ) return;
if (str.Length == 0)
{
ch.SendText("&nGlance at whom?\r\n");
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("&nThey're not here.\r\n");
return;
}
string msg = String.Format("&nYou glance at $N&n.\r\n$N&n is {0}.", SocketConnection.ConditionString(victim));
SocketConnection.Act(msg, ch, null, victim, SocketConnection.MessageTarget.character);
Look.ShowAffectLines(ch, victim);
return;
}
示例6: DirtToss
/// <summary>
/// Throw dirt in someone's eyes.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void DirtToss(CharData ch, string[] str)
{
if( ch == null ) return;
int percent;
/* Don't allow the unskilled to do this, check player's level */
if (!ch.HasSkill("dirt toss"))
{
ch.SendText("You get your feet dirty.\r\n");
return;
}
if (ch.IsBlind())
{
ch.SendText("You can't see anything!\r\n");
return;
}
if (ch.FlightLevel != 0)
{
ch.SendText("Perhaps you should land first matey.\r\n");
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
if (!victim || victim.CurrentPosition == Position.dead)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("How about sticking a fork your eye instead?\r\n");
return;
}
if (victim.IsAffected( Affect.AFFECT_BLIND))
{
SocketConnection.Act("$E's already been &+Lblinded&n.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
if (!ch.IsNPC())
{
percent = ((PC)ch).SkillAptitude["dirt toss"];
}
else
{
percent = (ch.Level * 3) / 2 + 25;
}
percent += (ch.Level - victim.Level) * 2;
percent += (ch.GetCurrDex() / 10);
percent -= (victim.GetCurrDex() / 10);
percent -= (victim.GetCurrAgi() / 10);
// Why waste time listing sectors with no modifier?
switch (ch.InRoom.TerrainType)
{
case TerrainType.inside:
case TerrainType.arctic:
case TerrainType.swamp:
percent -= 20;
break;
case TerrainType.city:
case TerrainType.mountain:
percent -= 10;
break;
case TerrainType.plane_of_fire:
case TerrainType.plane_of_air:
case TerrainType.plane_of_water:
case TerrainType.plane_ethereal:
case TerrainType.plane_astral:
case TerrainType.underwater_has_ground:
case TerrainType.underwater_no_ground:
case TerrainType.swimmable_water:
case TerrainType.unswimmable_water:
case TerrainType.air:
case TerrainType.ocean:
case TerrainType.underground_swimmable_water:
case TerrainType.underground_unswimmable_water:
percent = 0;
break;
case TerrainType.field:
//.........这里部分代码省略.........
示例7: Assist
/// <summary>
/// Assist someone in combat by joining them against their primary target.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Assist(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
if (!ch.IsBlind())
{
ch.SendText("You can't assist the invisible.\r\n");
return;
}
if (ch.Fighting)
{
ch.SendText("You're a bit busy at the moment.\r\n");
return;
}
if (str.Length != 0)
{
victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
else
{
ch.SendText("Assist who?\r\n");
return;
}
if (victim == ch)
{
ch.SendText("You're too busy assisting yourself to assist yourself.\r\n");
return;
}
if (!victim.Fighting)
{
ch.SendText("They're not fighting anyone.\r\n");
return;
}
if (victim.Fighting == ch)
{
ch.SendText("Assist!? They're fighting YOU, fool!\r\n");
return;
}
SocketConnection.Act("You scream a battle cry, and assist $N&n heroically.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n leaps into the fray, valiantly assisting you.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n charges into battle and assists $N&n heroically.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
Combat.SingleAttack(ch, victim.Fighting, String.Empty, ObjTemplate.WearLocation.hand_one);
return;
}
示例8: Trust
public static void Trust(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
string arg1 = String.Empty;
string arg2 = String.Empty;
int level;
CharData realChar = ch.GetChar();
if (!realChar.Authorized("trust"))
{
return;
}
if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2) || !MUDString.IsNumber(arg2))
{
ch.SendText("Syntax: trust <char> <level>.\r\n");
return;
}
if (!(victim = ch.GetCharRoom(arg1)))
{
ch.SendText("That player is not here.\r\n");
return;
}
Int32.TryParse(arg2, out level);
if (level < 1 || level > Limits.MAX_LEVEL)
{
ch.SendText(String.Format("Trust within range 1 to {0}.\r\n", Limits.MAX_LEVEL));
return;
}
if (level > ch.GetTrust())
{
ch.SendText("Limited to your trust.\r\n");
return;
}
string text = String.Format("{0} has been trusted at level {1} by {2}", victim.Name,
level, ch.Name);
ImmortalChat.SendImmortalChat(ch, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text);
victim.TrustLevel = level;
return;
}
示例9: 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;
}
}
示例10: Advance
/// <summary>
/// Immortal command to change a player's level.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Advance(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
string text;
int level = 0;
int iLevel = 0;
CharData realChar = ch.GetChar();
if (!realChar.Authorized("advance"))
{
return;
}
if (str.Length < 2 || String.IsNullOrEmpty(str[0]) || String.IsNullOrEmpty(str[1]) || !MUDString.IsNumber(str[1]))
{
ch.SendText("Syntax: advance <char> <level>.\r\n");
return;
}
if (!(victim = ch.GetCharRoom(str[0])))
{
ch.SendText("That player is not here.\r\n");
return;
}
if (victim.IsNPC())
{
ch.SendText("Not on NPC's.\r\n");
return;
}
Int32.TryParse(str[1], out level);
if (level < 1 || level > Limits.MAX_LEVEL)
{
ch.SendText(String.Format("Advance within range 1 to {0}.\r\n", Limits.MAX_LEVEL));
return;
}
if (level > ch.GetTrust())
{
ch.SendText("Limited to your trust level.\r\n");
return;
}
/*
* Lower level:
* Reset to level 1.
* Then raise again.
* Currently, an imp can lower another imp.
*/
if (level <= victim.Level)
{
ch.SendText("Lowering a player's level!\r\n");
victim.SendText("**** OOOOHHHHHHHHHH NNNNOOOO ****\r\n");
victim.Level = 1;
// Max_hit should only be accessed for PERMENANT changes.
victim.MaxHitpoints = 20;
if (ch.CharacterClass.GainsMana)
{
victim.MaxMana = 50;
// Mana bonuses for newbies.
victim.MaxMana += (victim.GetCurrInt() / 10);
victim.MaxMana += (victim.GetCurrWis() / 14);
victim.MaxMana += (victim.GetCurrPow() / 7);
}
else
{
victim.MaxMana = 0;
}
victim.MaxMoves = 150;
// removed resetting of skills.
victim.Hitpoints = victim.GetMaxHit();
victim.CurrentMana = victim.MaxMana;
victim.CurrentMoves = victim.MaxMoves;
text = String.Format("{0} has been demoted to level {1} by {2}", victim.Name,
level, ch.Name);
ImmortalChat.SendImmortalChat(victim, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text);
}
else
{
ch.SendText("Raising a player's level!\r\n");
victim.SendText("**** OOOOHHHHHHHHHH YYYYEEEESSS ****\r\n");
text = String.Format("{0} has been advanced to level {1} by {2}", victim.Name,
level, ch.Name);
ImmortalChat.SendImmortalChat(victim, ImmortalChat.IMMTALK_LEVELS, realChar.GetTrust(), text);
}
// Do not advance skills -- rerolling someone will auto-master
// their skills with no effort from the player... so we advance
// them with skills set to false -- Xangis
for (iLevel = victim.Level; iLevel < level; iLevel++)
//.........这里部分代码省略.........
示例11: Trip
/// <summary>
/// Attempt to trip a foe. Can initiate combat with this and can use during combat.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Trip(CharData ch, string[] str)
{
if( ch == null ) return;
int chance;
/* Check player's level and class, mobs can use this skill */
if ((!ch.HasSkill("trip")))
{
ch.SendText("You would just fall over if you tried to trip someone.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("You look around, unable to find them.\r\n");
return;
}
}
else
{
if (!victim)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
}
/* anti 'trip me' code */
if (victim == ch)
{
ch.SendText("You don't think you're clumsy enough already?\r\n");
return;
}
ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["trip"].Delay));
ch.PracticeSkill("trip");
if (ch.IsNPC())
{
chance = (ch.Level * 3) / 2 + 10;
}
else
{
chance = ((PC)ch).SkillAptitude["trip"];
}
if (chance > 90)
{
chance = 90;
}
if ((ch.Fighting == null) && (ch != victim))
{
Combat.SetFighting(ch, victim);
}
if ((!victim.Fighting) && (victim != ch))
{
Combat.SetFighting(victim, ch);
}
/* Mobs do NOT auto-trip! */
if (MUDMath.NumberPercent() < chance)
{
victim.WaitState((Skill.SkillList["trip"].Delay * 5 / 6));
SocketConnection.Act("You trip $N&n and send $M sprawling to the &n&+yearth&n!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n trips you and you go down!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n trips $N&n and $E falls face-first to the &n&+yground&n!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
if (victim.CurrentPosition > Position.reclining)
{
victim.CurrentPosition = Position.reclining;
}
}
else
{
SocketConnection.Act("You try to trip $N&n and fall down!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n attempts to knock you from your feet, and falls down $sself!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n tries to trip $N&n and tumbles to the &n&+yground&n!", ch, null, victim, SocketConnection.MessageTarget.room_vict);
ch.CurrentPosition = Position.reclining;
}
return;
}
示例12: 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);
}
//.........这里部分代码省略.........
示例13: Steal
/// <summary>
/// Steal an object or some coins from a victim.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Steal(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj = null;
CharData victim;
bool sleeping = false;
string arg1 = String.Empty;
string arg2 = String.Empty;
string arg = String.Empty;
int percent;
if (!ch.HasSkill("steal") && !ch.IsAffected(Affect.AFFECT_CHARM))
{
ch.SendText("Who are you trying to kid? You couldn't steal shoes from a &n&+mbl&+Mo&n&+ma&+Mte&n&+md&n corpse.\r\n");
return;
}
if (ch.Riding != null)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (String.IsNullOrEmpty(arg1) || String.IsNullOrEmpty(arg2))
{
ch.SendText("Steal what from whom?\r\n");
return;
}
if ((victim = ch.GetCharRoom(arg2)) == null)
{
ch.SendText("They aren't here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("That's pointless.\r\n");
return;
}
if (Combat.IsSafe(ch, victim))
return;
if (!ch.IsImmortal())
{
ch.WaitState(Skill.SkillList["steal"].Delay);
}
// Justice stuff
Crime.CheckThief(ch, victim);
if (ch.IsNPC())
{
percent = ch.Level * 2;
}
else
{
percent = ((PC)ch).SkillAptitude["steal"];
}
percent += ch.GetCurrLuck() / 20; /* Luck */
percent -= victim.Level; /* Character level vs victim's */
if (ch.GetRace() == Race.RACE_HALFLING)
{
// Halflings get a racial bonus
percent += 10;
}
if (victim.IsAffected(Affect.AFFECT_CURSE))
percent += 15;
if (ch.IsAffected(Affect.AFFECT_CURSE))
percent -= 15;
if (!victim.IsAwake())
percent += 25; /* Sleeping characters are easier */
if (ch.CheckSneak())
percent += 10; /* Quiet characters steal better */
if (!CharData.CanSee(ch, victim))
percent += 10; /* Unseen characters steal better */
if (!MUDString.IsPrefixOf(arg1, "coins"))
{
percent = (int)(percent * 1.2); /* Cash is fairly easy to steal */
}
else
{
int number = MUDString.NumberArgument(arg1, ref arg);
int count = 0;
//.........这里部分代码省略.........
示例14: Springleap
/// <summary>
/// Springleap. Can be used to initiate combat and can be used during combat.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Springleap(CharData ch, string[] str)
{
if( ch == null ) return;
int chance;
/* Check player's level and class, mobs can use this skill */
if ((!ch.HasSkill("springleap")))
{
ch.SendText("You'd better leave the martial arts to Bruce Lee.\r\n");
return;
}
if (ch.GetRace() == Race.RACE_CENTAUR)
{
ch.SendText("Your anatomy prevents you from springleaping.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
{
ch.SendText("You don't see them here.\r\n");
return;
}
}
else
{
if (!victim || victim.CurrentPosition == Position.dead)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
}
/* springleap self */
if (ch == victim)
{
ch.SendText("You can't quite figure out how to do that.\r\n");
return;
}
/* Check size of ch vs. victim. */
/* If ch is too small. */
if (ch.CurrentSize - 2 > victim.CurrentSize)
{
SocketConnection.Act("Your acrobatic maneuver cannot accurately leap into such a small being.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
/* Ch 2 or more sizes larger than victim => bad! */
if (ch.CurrentSize + 2 < victim.CurrentSize)
{
SocketConnection.Act("Your acrobatic maneuver does not seem to work on someone so large.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n jumps into you, and slides down your leg.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$n&n jumps into $N&n and slides down $S leg.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
ch.WaitState(Skill.SkillList["springleap"].Delay);
ch.CurrentPosition = Position.reclining;
if (victim.Fighting == null)
{
Combat.SetFighting(victim, ch);
}
return;
}
ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["springleap"].Delay));
ch.PracticeSkill("springleap");
if (ch.IsNPC())
{
chance = (ch.Level * 3) / 2 + 15;
}
else
{
chance = ((PC)ch).SkillAptitude["springleap"] - 5;
}
if (chance > 95)
{
chance = 95;
}
if (victim.CurrentPosition < Position.fighting)
{
chance /= 4;
}
//.........这里部分代码省略.........
示例15: Consider
/// <summary>
/// Consider killing a target. Lets the actor know whether it would be a good idea or not.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Consider(CharData ch, string[] str)
{
if( ch == null ) return;
string msg;
if (str.Length == 0)
{
ch.SendText("&nConsider killing whom?\r\n");
return;
}
CharData victim = ch.GetCharRoom(str[0]);
if (!victim)
{
ch.SendText("&nThey're not here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("Killing yourself? Try 'suicide confirm'.\r\n");
return;
}
int diff = victim.Level - ch.Level;
if (victim.IsAffected( Affect.AFFECT_PROWESS))
diff += (5 + victim.Level / 5);
if (victim.IsAffected( Affect.AFFECT_INCOMPETENCE))
diff -= (5 + victim.Level / 5);
if (ch.HasActionBit(PC.PLAYER_COLOR_CON))
{
if (diff <= -10)
msg = "&n&+bToo easy to bother with.&n";
else if (diff <= -5)
msg = "&n&+bYou could do it blindfolded!&n";
else if (diff <= -2)
msg = "&n&+BEasy.&n";
else if (diff <= -1)
msg = "&n&+gFairly easy.&n";
else if (diff <= 0)
msg = "&n&+GAn even fight!&n";
else if (diff <= 1)
msg = "&n&+gYou would need some luck.&n";
else if (diff <= 2)
msg = "&n&+yYou would need a lot of luck!&n";
else if (diff <= 3)
msg = "&n&+YYou would need a lot of luck and great equipment!&n";
else if (diff <= 5)
msg = "&n&+YYou would probably lose that fight.&n";
else if (diff <= 10)
msg = "&n&+RAre you mad!?&n";
else if (diff <= 15)
msg = "&n&+RYou ARE mad!&n";
else if (diff <= 20)
msg = "&n&+rWhy don't you just lie down and pretend you're dead instead?&n";
else if (diff <= 25)
msg = "&n&+rWhat do you want your epitaph to say?!?&n";
else
msg = "&n&+LYou wouldn't last one round of combat!&n";
}
else
{
if (diff <= -10)
msg = "&nToo easy to bother with.&n";
else if (diff <= -5)
msg = "&nYou could do it blindfolded!&n";
else if (diff <= -2)
msg = "&nEasy.&n";
else if (diff <= -1)
msg = "&nFairly easy.&n";
else if (diff <= 0)
msg = "&nAn even fight!&n";
else if (diff <= 1)
msg = "&nYou would need some luck.&n";
else if (diff <= 2)
msg = "&nYou would need a lot of luck!&n";
else if (diff <= 3)
msg = "&nYou would need a lot of luck and great equipment!&n";
else if (diff <= 5)
msg = "&nYou would probably lose that fight.&n";
else if (diff <= 10)
msg = "&nAre you mad!?&n";
else if (diff <= 15)
msg = "&nYou ARE mad!&n";
else if (diff <= 20)
msg = "&nWhy don't you just lie down and pretend you're dead instead?&n";
else if (diff <= 25)
msg = "&nWhat do you want your epitaph to say?!?&n";
else
msg = "&nYou wouldn't last one round of combat!&n";
}
//.........这里部分代码省略.........