本文整理汇总了C#中MUDEngine.CharData.IsBlind方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.IsBlind方法的具体用法?C# CharData.IsBlind怎么用?C# CharData.IsBlind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.IsBlind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Eat
/// <summary>
/// Eat something.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Eat(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj;
if (ch.IsBlind())
return;
if (ch.Fighting || ch.CurrentPosition == Position.fighting)
{
ch.SendText("You can't eat while you're fighting!\r\n");
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)
{
//.........这里部分代码省略.........
示例2: Exits
/// <summary>
/// Shows available room exits.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Exits(CharData ch, string[] str)
{
if( ch == null ) return;
Exit exit;
int door;
bool auto = (str.Length != 0 && !MUDString.StringsNotEqual(str[0], "auto"));
if (ch.IsBlind() || !ch.InRoom)
{
return;
}
string text;
if (!ch.IsNPC() && ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED && auto)
{
text = "<exits>";
}
else
{
text = auto ? "&+cExits: &n" : "&+cVisible exits:&n\r\n";
}
bool found = false;
// Show the direction with an asterisk if it
// has a closed door, and in exits command it shows up as a
// closed <whatever>.
for (door = 0; door < Limits.MAX_DIRECTION; ++door)
{
exit = ch.InRoom.ExitData[door];
if (exit && exit.TargetRoom)
{
if (exit.HasFlag(Exit.ExitFlag.secret))
{
/* Mortals do not see secret exits. */
if (ch.Level < Limits.LEVEL_AVATAR)
continue;
/* Mark secret exits for immortals. */
text += "&+LS&n&+c";
}
if (exit.HasFlag(Exit.ExitFlag.blocked))
{
/* Mortals do not see secret exits. */
if (ch.Level < Limits.LEVEL_AVATAR)
continue;
/* Mark secret exits for immortals. */
text += "&+yB&n&+c";
}
found = true;
if (auto)
{
if (exit.HasFlag(Exit.ExitFlag.walled) && exit.HasFlag(Exit.ExitFlag.illusion))
continue;
if (exit.HasFlag(Exit.ExitFlag.closed))
text += "&n&+y#&n&+c";
// Don't show exits to impassable rooms.
// Show a yellow exclamation point to those with holylight on though.
if (exit.TargetRoom && exit.TargetRoom.TerrainType == TerrainType.underground_impassable)
{
if (!ch.HasActionBit(PC.PLAYER_GODMODE))
{
continue;
}
text += "&+Y!&n";
}
text += door.ToString();
text += " ";
}
else
{
if (exit.HasFlag(Exit.ExitFlag.walled))
{
text += String.Format("&n{0} - (Walled)&n\r\n",
MUDString.PadStr(door.ToString().ToUpper(), 5));
}
else if (!exit.HasFlag(Exit.ExitFlag.closed))
{
// gods with holylight on can go to useless exits.
if (exit.TargetRoom && exit.TargetRoom.TerrainType == TerrainType.underground_impassable)
{
if (!ch.HasActionBit(PC.PLAYER_GODMODE))
{
continue;
}
text += "&+Y!&n";
}
text += String.Format("&n {0} - {1}&n\r\n", MUDString.PadStr(door.ToString().ToUpper(), 5),
(!ch.HasInnate(Race.RACE_ULTRAVISION) && Room.GetRoom(exit.IndexNumber).IsDark())
? "&nToo dark to tell" : exit.TargetRoom.Title);
}
else
{
text += String.Format("&+y#&n{0} - Closed {1}\r\n",
//.........这里部分代码省略.........
示例3: 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;
}
示例4: Drink
/// <summary>
/// Ingest a liquid.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Drink(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj = null;
if (ch.IsBlind())
{
return;
}
if (ch.Fighting || ch.CurrentPosition == Position.fighting)
{
ch.SendText("You can't drink while you're fighting!\r\n");
return;
}
if (str.Length == 0 && ch.InRoom != null)
{
foreach (Object iobj in ch.InRoom.Contents)
{
if (iobj.ItemType == ObjTemplate.ObjectType.drink_container)
{
obj = iobj;
break;
}
}
if (!obj)
{
ch.SendText("Drink what?\r\n");
return;
}
}
else
{
if (!(obj = ch.GetObjHere(str[0])))
{
ch.SendText("You can't find it.\r\n");
return;
}
}
// Allow bards to get twice as drunk as other classes - Xangis
if (!ch.IsNPC() && !ch.IsImmortal()
&& ((PC)ch).Drunk > 15 && ch.IsClass(CharClass.Names.bard)
&& MUDMath.NumberPercent() < ch.GetCurrAgi() - ((PC)ch).Drunk)
{
ch.SendText("You fail to reach your mouth. *Hic*\r\n");
return;
}
if (!ch.IsNPC() && !ch.IsImmortal()
&& ((PC)ch).Drunk > 25 && ch.IsClass(CharClass.Names.bard)
&& MUDMath.NumberPercent() < ch.GetCurrAgi() - ((PC)ch).Drunk)
{
ch.SendText("You fail to reach your mouth. *Hic*\r\n");
return;
}
switch (obj.ItemType)
{
default:
ch.SendText("You can't drink from that.\r\n");
break;
case ObjTemplate.ObjectType.drink_container:
// -1 Means a container never goes empty.
if (obj.Values[1] <= 0 && obj.Values[1] != -1)
{
ch.SendText("It is already &+Lempty&n.\r\n");
return;
}
/* No drinking if you're full */
if ((!ch.IsImmortal()) && (
(!ch.IsNPC() && ((PC)ch).Thirst > 40) ||
(!ch.IsNPC() && ((PC)ch).Hunger > 50)))
{
ch.SendText("You couldn't possibly drink any more.\r\n");
return;
}
int liquid;
if ((liquid = obj.Values[2]) >= Liquid.Table.Length)
{
Log.Error("Drink: bad liquid number {0}.", liquid);
liquid = obj.Values[2] = 0;
}
SocketConnection.Act("You drink $T from $p&n.",
ch, obj, Liquid.Table[liquid].Name, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n drinks $T from $p&n.",
ch, obj, Liquid.Table[liquid].Name, SocketConnection.MessageTarget.room);
//.........这里部分代码省略.........
示例5: Kick
/// <summary>
/// Kick someone.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Kick(CharData ch, string[] str)
{
if( ch == null ) return;
int chance;
int wallkickchance;
/* Check player's level and class, allow mobs to do this too */
if ((!ch.HasSkill("kick")))
{
ch.SendText("You'd better leave the martial arts to fighters.\r\n");
return;
}
if (ch.IsBlind() && !ch.Fighting)
{
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
victim = ch.GetCharRoom(str[0]);
if (!victim || victim.CurrentPosition == Position.dead)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
else
{
if (!victim || victim.CurrentPosition == Position.dead)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
}
if (victim == ch)
{
ch.SendText("You kick yourself for being a dummy.\r\n");
return;
}
ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["kick"].Delay));
if (!ch.IsNPC())
{
chance = ((PC)ch).SkillAptitude["kick"];
ch.PracticeSkill("kick");
}
else
{
chance = ch.Level * 3 / 2 + 20;
}
// It's much harder to kick really tiny things; imagine trying to kick
// a fly.
if (ch.CurrentSize > victim.CurrentSize + 5)
{
chance -= (ch.CurrentSize - victim.CurrentSize) * 5;
}
// It's harder to kick things that move faster than you.
chance += ((ch.GetCurrAgi() - victim.GetCurrAgi()) / 5);
// Huge bonus against incapacitated and mortally wounded foes.
if (victim.CurrentPosition <= Position.incapacitated)
{
chance += 50;
}
// Damned high penalty for kicking blind
if (ch.IsAffected(Affect.AFFECT_BLIND) && !victim.IsAffected(Affect.AFFECT_BLIND))
{
chance /= 10;
}
if (ch.IsAffected(Affect.AFFECT_BLIND) && victim.IsAffected(Affect.AFFECT_BLIND))
{
chance /= 4;
}
// If the victim is two or more sizes smaller than the kicker give them a chance
// to be kicked into a wall or out of the room.
//
// Chance of 5% per size class difference, no maximum
// (wall/room kick is 50% at a difference of 10 sizes)
if (victim.CurrentSize - 1 >= ch.CurrentSize)
{
wallkickchance = 0;
}
else
{
wallkickchance = ((ch.CurrentSize - victim.CurrentSize) * 5) - 5;
}
//.........这里部分代码省略.........
示例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: 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;
}
示例8: 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
*/
//.........这里部分代码省略.........
示例9: Rescue
/// <summary>
/// Rescue command. Interpose yourself between the target and their opponent so you become
/// the one taking damage.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Rescue(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
/* Don't allow the unskilled to rescue */
if ((!ch.HasSkill("rescue")))
{
ch.SendText("You'd better leave the heroic acts to warriors.\r\n");
return;
}
if (ch.IsAffected(Affect.AFFECT_BERZERK))
{
ch.SendText("You can't rescue anyone, you're in a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!\r\n");
return;
}
if (ch.Riding)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Rescue whom?\r\n");
return;
}
if (!(victim = ch.GetCharRoom(str[0])))
{
ch.SendText("They aren't here.\r\n");
return;
}
if (victim == ch)
{
ch.SendText("What about fleeing instead?\r\n");
return;
}
if (ch.Fighting == victim)
{
ch.SendText("Too late.\r\n");
return;
}
if (!victim.Fighting)
{
ch.SendText("That person is not fighting right now.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
ch.WaitState(Skill.SkillList["rescue"].Delay);
int count = 0;
CharData fighter = null;
foreach (CharData ifch in ch.InRoom.People)
{
if (ifch.Fighting == victim)
{
if (MUDMath.NumberRange(0, count) == 0)
{
fighter = ifch;
break;
}
++count;
}
}
if (!fighter || !ch.CheckSkill("rescue"))
{
SocketConnection.Act("$n&n fails miserably in $s attempt to rescue $N&n.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
SocketConnection.Act("$n&n fails miserably in $s attempt to rescue you.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("You fail in your attempt to rescue $N&n.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
SocketConnection.Act("&+WYou leap in front of $N&n!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("&+W$n&+W rescues you!", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("&+w$n&+w leaps in front of $N&+w taking his place in battle!&n", ch, null, victim, SocketConnection.MessageTarget.room_vict);
Combat.StopFighting(fighter, false);
Combat.StopFighting(victim, false);
Combat.SetFighting(fighter, ch);
if (!ch.Fighting)
//.........这里部分代码省略.........
示例10: 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;
}
//.........这里部分代码省略.........
示例11: Bodyslam
/// <summary>
/// Bodyslam an opponent. Can only be used to initiate combat.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Bodyslam(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
/* Check player's level and class, mobs can use this skill */
if (!ch.HasInnate(Race.RACE_BODYSLAM))
{
ch.SendText("You don't feel massive enough to manhandle that.\r\n");
return;
}
if (ch.IsBlind())
{
return;
}
if (ch.Riding)
{
ch.SendText("You can't do that while mounted.\r\n");
return;
}
if (str.Length != 0)
{
if (!(victim = ch.GetCharRoom(str[0])) || victim.CurrentPosition == Position.dead)
{
ch.SendText("They aren't here.\r\n");
return;
}
}
else
{
ch.SendText("Bodyslam who?\r\n");
return;
}
// Added size restrictions -- Xangis
if (victim.CurrentSize > ch.CurrentSize)
{
if (ch.HasInnate(Race.RACE_SLAM_LARGER))
{
// allowing centaurs to slam one size up if it's an ogre
if (victim.CurrentSize > (ch.CurrentSize + 1))
{
ch.SendText("You can't bodyslam something that much bigger than you.\r\n");
return;
}
}
else
{
ch.SendText("You can't bodyslam something bigger than you.\r\n");
return;
}
}
if ((ch.CurrentSize > victim.CurrentSize) && ((ch.CurrentSize - victim.CurrentSize) > 3))
{
ch.SendText("They're too small to slam.\r\n");
return;
}
/* Bodyslam self? Ok! */
if (ch == victim)
{
ch.SendText("You slam yourself to the ground!\r\n");
SocketConnection.Act("$n&n throws $mself to the ground in a fit of clumsiness.",
ch, null, victim, SocketConnection.MessageTarget.room_vict);
ch.WaitState((Skill.SkillList["bodyslam"].Delay / 2));
ch.CurrentPosition = Position.reclining;
Combat.InflictDamage(ch, ch, MUDMath.NumberRange(1, 6), "bodyslam", ObjTemplate.WearLocation.none, AttackType.DamageType.bludgeon);
return;
}
ch.WaitState(Skill.SkillList["bodyslam"].Delay);
ch.PracticeSkill("bodyslam");
int chance = (ch.Level * 3) / 2 + 15;
chance += ch.GetCurrAgi() - victim.GetCurrAgi();
chance -= (victim.Level - ch.Level);
switch (victim.CurrentPosition)
{
case Position.dead:
return;
case Position.mortally_wounded:
chance += 15;
break;
case Position.incapacitated:
chance += 10;
break;
case Position.unconscious:
chance += 5;
break;
case Position.stunned:
//.........这里部分代码省略.........
示例12: Pour
/// <summary>
/// Pour a liquid.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Pour(CharData ch, string[] str)
{
if( ch == null ) return;
Object obj;
string arg1 = String.Empty;
string arg2 = String.Empty;
if (ch.IsBlind())
return;
if (!(obj = ch.GetObjCarrying(arg1)))
{
ch.SendText("You do not have that item.\r\n");
return;
}
if (obj.ItemType != ObjTemplate.ObjectType.drink_container)
{
ch.SendText("You can't fill that.\r\n");
return;
}
if (!MUDString.StringsNotEqual("out", arg2))
{
ch.SendText("You pour it out.\r\n");
obj.Values[1] = 0;
return;
}
Object otherobj = ch.GetObjHere(arg2);
if (!otherobj)
{
ch.SendText("Pour it where?\r\n");
return;
}
if (otherobj.Values[2] != obj.Values[2] && otherobj.Values[1] != 0)
{
ch.SendText("It's got another liquid in it.\r\n");
return;
}
SocketConnection.Act("You fill $p&n.", ch, otherobj, null, SocketConnection.MessageTarget.character);
otherobj.Values[2] = obj.Values[2];
otherobj.Values[1] += obj.Values[1];
obj.Values[1] = 0;
// Over pour in code => just pour it back in the first container.
if (otherobj.Values[1] > otherobj.Values[0])
{
obj.Values[1] = otherobj.Values[1] - otherobj.Values[0];
otherobj.Values[1] = otherobj.Values[0];
}
return;
}
示例13: LookCommand
/// <summary>
/// Looks at an object, mobile, or room.
/// </summary>
/// <param name="ch">The acting character.</param>
/// <param name="str">Command arguments.</param>
public static void LookCommand(CharData ch, string[] str)
{
if( ch == null ) return;
// Build argument list, stripping articles.
bool inside = false;
List<String> args = new List<string>(str);
for (int i = (args.Count - 1); i >= 0; i-- )
{
if (args[i].Equals("in", StringComparison.CurrentCultureIgnoreCase) || args[i].Equals("i", StringComparison.CurrentCultureIgnoreCase))
{
args.RemoveAt(i);
inside = true;
}
else if (args[i].Equals("at", StringComparison.CurrentCultureIgnoreCase))
{
args.RemoveAt(i);
}
}
// If it's a mob that isn't switched, bail.
if (ch.Socket == null)
return;
if (ch.CurrentPosition < Position.sleeping)
{
ch.SendText("&nYou can't see anything but &+Ystars&n! See how pretty!\r\n");
return;
}
if (ch.CurrentPosition == Position.sleeping)
{
ch.SendText("&nYou can't see anything, you're &+Lsleeping&n! Zzz.\r\n");
return;
}
if (ch.IsBlind())
return;
// Look panel for ships.
if ( args.Count > 0 && args[0].Equals("panel", StringComparison.CurrentCultureIgnoreCase))
{
CommandType.Interpret(ch, "Lookpanel");
return;
}
// Look out for ships.
if (args.Count > 0 && args[0].Equals("out", StringComparison.CurrentCultureIgnoreCase))
{
CommandType.Interpret(ch, "Lookout");
return;
}
Object obj;
Exit exit;
string pdesc;
int number = 0;
string output = String.Empty;
// 'look' or 'look auto' or 'look room'
if (args.Count == 0 || args[0].Equals( "auto", StringComparison.CurrentCultureIgnoreCase) ||
args[0].Equals("room", StringComparison.CurrentCultureIgnoreCase))
{
if (ch.InRoom == null)
{
ch.SendText("You are not in a room. You are just floating in empty space. This should never happen. You should <petition> someone for help.\r\n");
Log.Error("Character executing Commandlook command from null room: " + ch.Name);
return;
}
if (ch.FlightLevel > 0)
{
switch (ch.FlightLevel)
{
case CharData.FlyLevel.low:
ch.SendText("Hovering above ");
break;
case CharData.FlyLevel.medium:
ch.SendText("Flying above ");
break;
case CharData.FlyLevel.high:
ch.SendText("Flying high above ");
break;
}
}
if (!ch.HasActionBit(PC.PLAYER_GODMODE) && ch.InRoom.IsDark()
&& !ch.HasInnate(Race.RACE_ULTRAVISION)
&& !ch.IsAffected( Affect.AFFECT_ULTRAVISION))
{
ch.SendText("&+lSomewhere\r\n");
}
else if (!ch.HasActionBit(PC.PLAYER_GODMODE))
{
String roomOpen = String.Empty;
String roomClose = String.Empty;
if (!ch.IsNPC() && ch.Socket.Terminal == SocketConnection.TerminalType.TERMINAL_ENHANCED)
{
//.........这里部分代码省略.........
示例14: Fill
public static void Fill(CharData ch, string[] str)
{
if( ch == null ) return;
Object fountain = null;
if (ch.IsBlind())
{
ch.SendText("You can't see what you're trying to fill.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Fill what?\r\n");
return;
}
Object obj = ch.GetObjCarrying(str[0]);
if (!obj)
{
ch.SendText("You do not have that item.\r\n");
return;
}
bool found = false;
foreach (Object fount in ch.InRoom.Contents)
{
if (fount.FlyLevel != ch.FlightLevel)
continue;
if (fount.ItemType == ObjTemplate.ObjectType.drink_container)
{
fountain = fount;
found = true;
break;
}
}
if (!found)
{
ch.SendText("There is nothing to fill from here!\r\n");
return;
}
if (obj.ItemType != ObjTemplate.ObjectType.drink_container)
{
ch.SendText("You can't fill that.\r\n");
return;
}
if (obj.Values[1] != 0 && obj.Values[2] != fountain.Values[2])
{
ch.SendText("There is already another liquid in it.\r\n");
return;
}
if (obj.Values[1] >= obj.Values[0])
{
ch.SendText("Your container is full.\r\n");
return;
}
SocketConnection.Act("You fill $p&n.", ch, obj, null, SocketConnection.MessageTarget.character);
obj.Values[2] = fountain.Values[2];
obj.Values[1] = obj.Values[0];
return;
}
示例15: WherePlayer
public static void WherePlayer(CharData ch, string[] str)
{
if( ch == null ) return;
CharData victim;
SocketConnection socket;
string buf;
bool found;
if (ch.IsBlind())
return;
if (str.Length == 0)
{
ch.SendText("&nPlayers near you:\r\n");
found = false;
foreach (SocketConnection it in Database.SocketList)
{
socket = it;
if (socket.ConnectionStatus == SocketConnection.ConnectionState.playing && (victim = socket.Character)
&& !victim.IsNPC() && victim.InRoom
&& victim.InRoom.Area == ch.InRoom.Area && CharData.CanSee(ch, victim))
{
found = true;
buf = String.Format("%{0} {1}\r\n",
MUDString.PadStr(victim.Name, 28), victim.InRoom.Title);
ch.SendText(buf);
}
}
if (!found)
ch.SendText("None\r\n");
}
else if (!MUDString.IsPrefixOf(str[0], "all"))
{
ch.SendText("&nPlayer locations:\r\n");
found = false;
foreach (SocketConnection it in Database.SocketList)
{
socket = it;
if (socket.ConnectionStatus == SocketConnection.ConnectionState.playing && (victim = socket.Character) && !victim.IsNPC()
&& victim.InRoom && CharData.CanSee(ch, victim))
{
found = true;
buf = String.Format("{0} [{1}]{2}&n\r\n",
MUDString.PadStr(victim.Name, 28),
MUDString.PadInt(victim.InRoom.IndexNumber, 7),
victim.InRoom.Title);
ch.SendText(buf);
}
}
if (!found)
ch.SendText("None\r\n");
}
else
{
found = false;
foreach (CharData it in Database.CharList)
{
victim = it;
if (victim.InRoom.Area == ch.InRoom.Area
&& CharData.CanSee(ch, victim)
&& MUDString.NameContainedIn(str[0], victim.Name))
{
found = true;
buf = String.Format("{0} {1}\r\n",
MUDString.PadStr(victim.ShowNameTo(ch, true), 28), victim.InRoom.Title);
ch.SendText(buf);
break;
}
}
if (!found)
SocketConnection.Act("&nYou didn't find any $T.", ch, null, str[0], SocketConnection.MessageTarget.character);
}
return;
}