本文整理汇总了C#中MUDEngine.CharData.HasSkill方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.HasSkill方法的具体用法?C# CharData.HasSkill怎么用?C# CharData.HasSkill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.HasSkill方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bodyslam
//.........这里部分代码省略.........
break;
case Position.kneeling:
chance -= 15;
break;
case Position.fighting:
case Position.standing:
default:
break;
}
// Small penalty for the small buggers -- Xangis
if (victim.CurrentSize < (ch.CurrentSize - 1))
{
chance -= 15;
}
if (chance > 90)
{
chance = 90;
}
// Shaman bodyslam penalty.
if (ch.IsClass(CharClass.Names.shaman) || ch.IsClass(CharClass.Names.druid))
{
chance = (chance * 2) / 3;
}
if (victim.IsAffected(Affect.AFFECT_AWARE))
{
chance -= 15;
}
else if (victim.IsAffected( Affect.AFFECT_SKL_AWARE))
{
if (ch.HasSkill("springleap"))
{
if (ch.IsNPC())
{
if (MUDMath.NumberPercent() < ((ch.Level * 3) / 2 + 15))
{
chance -= 15;
}
}
else if (MUDMath.NumberPercent() < ((PC)ch).SkillAptitude["awareness"])
{
ch.PracticeSkill("awareness");
chance -= 15;
}
else
{
ch.PracticeSkill("awareness");
}
}
}
if (!ch.Fighting)
{
Combat.SetFighting(ch, victim);
}
if (victim.Fighting == null)
{
Combat.SetFighting(victim, ch);
}
if (ch.IsNPC() || MUDMath.NumberPercent() < chance)
{
if (victim.IsAffected( Affect.AFFECT_SINGING))
示例2: Heighten
public static void Heighten(CharData ch, string[] str)
{
if( ch == null ) return;
Affect af = new Affect();
if (!ch.IsNPC() && !ch.HasSkill("heighten senses"))
{
ch.SendText("Your senses are as heightened as they're going to get.\r\n");
return;
}
if (ch.HasAffect( Affect.AffectType.skill, "heighten senses"))
return;
if (ch.CheckSkill("heighten senses"))
{
af.Value = "heighten senses";
af.Type = Affect.AffectType.skill;
af.Duration = 24 + ch.Level;
af.SetBitvector(Affect.AFFECT_DETECT_INVIS);
ch.AddAffect(af);
af.SetBitvector(Affect.AFFECT_SENSE_LIFE);
ch.AddAffect(af);
af.SetBitvector(Affect.AFFECT_INFRAVISION);
ch.AddAffect(af);
ch.SendText("Your senses are heightened.\r\n");
}
return;
}
示例3: FoundPrey
//.........这里部分代码省略.........
{
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:
Command.Say(ch, new string[]{"Just wait until I find you..."});
break;
default:
SocketConnection.Act("$p peers about looking for something.", ch, null, null, SocketConnection.MessageTarget.room);
break;
}
return;
}
if (ch.InRoom.HasFlag(RoomTemplate.ROOM_SAFE) && ch.IsNPC())
{
text = String.Format("Hunting mob {0} found a safe room {1}.", ch.MobileTemplate.IndexNumber, ch.InRoom.IndexNumber);
Log.Trace(text);
return;
}
if (ch.CurrentPosition > Position.kneeling)
{
switch (MUDMath.NumberBits(5))
{
case 0:
text = String.Format("I will eat your heart, {0}!", victname);
Command.Say(ch, new string[]{text});
break;
case 1:
text = String.Format("You want a piece of me, {0}?", victname);
Command.Say(ch, new string[]{text});
break;
case 2:
text = String.Format("How does your flesh taste {0}, like chicken?", victname);
Command.Say(ch, new string[]{text});
break;
case 3:
SocketConnection.Act("$n&n howls gleefully and lunges at $N&n!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
SocketConnection.Act("$n&n howls gleefully and lunges at you!", ch, null, victim, SocketConnection.MessageTarget.victim);
break;
case 4:
SocketConnection.Act("$n&n charges headlong into $N&n!", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim);
SocketConnection.Act("$n&n charges headlong into you!", ch, null, victim, SocketConnection.MessageTarget.victim);
break;
default:
break;
}
Combat.StopHunting(ch);
Combat.CheckAggressive(victim, ch);
if (ch.Fighting)
return;
// Backstab if able, otherwise just kill them.
// Kill if they don't have the skill or if they don't have a stabber.
if (!ch.HasSkill("backstab"))
{
Combat.CombatRound(ch, victim, String.Empty);
}
else if (!Combat.Backstab(ch, victim))
{
Combat.CombatRound(ch, victim, String.Empty);
}
}
return;
}
示例4: 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;
}
示例5: 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
*/
//.........这里部分代码省略.........
示例6: Disarm
/// <summary>
/// Knock the weapon from an opponent's hand.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Disarm(CharData ch, string[] str)
{
if( ch == null ) return;
int odds;
/* Don't allow charmed mobiles to do this, check player's level */
if ((ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM))
|| (!ch.IsNPC() && !ch.HasSkill("disarm")))
{
ch.SendText("You don't know how to disarm opponents.\r\n");
return;
}
if (!Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one)
&& !Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_two))
{
ch.SendText("You must wield a weapon to disarm.\r\n");
return;
}
if (!ch.Fighting)
{
ch.SendText("You aren't fighting anyone.\r\n");
return;
}
CharData victim = ch.Fighting;
if (str.Length != 0)
{
if (!(victim = ch.GetCharRoom(str[0])))
{
ch.SendText("They aren't here.\r\n");
return;
}
}
if (victim.Fighting != ch && ch.Fighting != victim)
{
SocketConnection.Act("$E is not fighting you!", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
if (!Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_one)
&& !Object.GetEquipmentOnCharacter(victim, ObjTemplate.WearLocation.hand_two))
{
ch.SendText("Your opponent is not wielding a weapon.\r\n");
return;
}
if (victim.Level > ch.Level + 10)
{
ch.SendText("They are much too clever for such a clumsy attempt at that maneuver.\r\n");
return;
}
ch.WaitState(Skill.SkillList["disarm"].Delay);
ch.PracticeSkill("disarm");
if (ch.IsNPC())
{
odds = ch.Level;
}
else
{
odds = ((PC)ch).SkillAptitude["disarm"] / 2;
}
if (victim.IsNPC())
{
odds += 2 * (ch.Level - victim.Level);
}
else
{
/* Offense skill helps prevent disarms */
odds -= ((PC)victim).SkillAptitude["offense"] / 4;
}
if (!Object.GetEquipmentOnCharacter(ch, ObjTemplate.WearLocation.hand_one))
{
odds /= 2; /* 1/2 as likely with only 2nd weapon */
}
odds = Math.Min(odds, 98);
odds = Math.Max(odds, 2);
string lbuf = String.Format("Disarm: {0} attempting with {1}%% chance.", ch.Name, odds);
ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, lbuf);
if (MUDMath.NumberPercent() < odds)
{
Combat.Disarm(ch, victim);
}
else if (MUDMath.NumberPercent() > 80)
{
ch.SendText("Expertly countering your maneuver, they dislodge your weapon and send it flying.\r\n");
Combat.Disarm(victim, ch);
}
else
{
//.........这里部分代码省略.........
示例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: 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;
//.........这里部分代码省略.........
示例9: 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);
}
//.........这里部分代码省略.........
示例10: 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;
}
示例11: 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;
}
//.........这里部分代码省略.........
示例12: Shadow
public static void Shadow(CharData ch, string[] str)
{
if( ch == null ) return;
Affect af = new Affect();
if (!ch.IsNPC()
&& !ch.HasSkill("shadow form"))
{
ch.SendText("You don't know how to take shadow form.\r\n");
return;
}
ch.SendText("You attempt to move in the shadows.\r\n");
ch.AffectStrip( Affect.AffectType.skill, "shadow form");
if (ch.CheckSkill("shadow form"))
{
af.Value = "shadow form";
af.Type = Affect.AffectType.skill;
af.Duration = ch.Level;
af.SetBitvector(Affect.AFFECT_SNEAK);
ch.AddAffect(af);
}
ch.WaitState(10);
return;
}
示例13: Scribe
/// <summary>
/// Command to add a spell to your spellbook.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Scribe(CharData ch, string[] str)
{
if( ch == null ) return;
bool found = false;
if (ch.IsNPC())
return;
if (!ch.InRoom)
{
ch.SendText("You're not in a proper place for scribing.\r\n");
return;
}
CharData teacher = null;
foreach (CharData iteacher in ch.InRoom.People)
{
if (!iteacher.IsNPC())
continue;
if (iteacher.HasActionBit(MobTemplate.ACT_TEACHER))
{
teacher = iteacher;
break;
}
}
if (teacher == null)
{
ch.SendText("Nobody here can teach you anything.\r\n");
return;
}
foreach (Object quill in ch.Carrying)
{
if (quill.ItemType == ObjTemplate.ObjectType.pen)
{
found = true;
break;
}
}
if (!found)
{
ch.SendText("You have nothing to write with!\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Scribe what?\r\n");
return;
}
Spell spell = StringLookup.SpellLookup(String.Join(" ", str));
if (spell == null)
{
ch.SendText("No such spell.\r\n");
return;
}
if ((spell.SpellCircle[(int)teacher.CharacterClass.ClassNumber] * 4) >
(teacher.Level + 3))
{
ch.SendText("The teacher does not know that spell.\r\n");
return;
}
if (!spell.CanBeScribed)
{
ch.SendText("That spell is not common knowledge - You must quest for it.\r\n");
return;
}
if ((spell.SpellCircle[(int)ch.CharacterClass.ClassNumber] * 4) > (ch.Level + 3))
{
ch.SendText("That spell is beyond you.\r\n");
return;
}
if (!((PC)ch).SpellAptitude.ContainsKey(spell.Name) || ((PC)ch).SpellAptitude[spell.Name] < 1)
{
// Scribe is used so rarely give them 5 chances to learn it...
ch.PracticeSkill("Scribe");
ch.PracticeSkill("Scribe");
ch.PracticeSkill("Scribe");
ch.PracticeSkill("Scribe");
ch.PracticeSkill("Scribe");
string buf = String.Format("You scribe {0}.\r\n", spell.Name);
ch.SendText(buf);
((PC)ch).SpellAptitude[spell.Name] = Limits.BASE_SPELL_ADEPT;
int chance = 0;
if (ch.HasSkill("scribe"))
{
//.........这里部分代码省略.........
示例14: 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)
//.........这里部分代码省略.........
示例15: Climb
/// <summary>
/// Command to climb something.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Climb(CharData ch, string[] str)
{
if( ch == null ) return;
int chance;
if (!ch.HasSkill("climb"))
{
ch.SendText("You lack the skills to climb anything.\r\n");
return;
}
if (str.Length == 0)
{
ch.SendText("Climb what?\r\n");
return;
}
Object obj = ch.GetObjHere(str[0]);
if (!obj)
{
ch.SendText("Uhh... what exactly did you want to climb!?\r\n");
return;
}
if (obj.ItemType != ObjTemplate.ObjectType.wall)
{
ch.SendText("That wasn't exactly designed for climbing.\r\n");
return;
}
if (ch.IsNPC())
{
chance = ch.Level * 3 / 2 + 20;
}
else
{
chance = ((PC)ch).SkillAptitude["climb"];
}
// Agility helps.
chance += ch.GetCurrAgi() / 10;
switch (obj.ObjIndexData.IndexNumber)
{
case StaticObjects.OBJECT_NUMBER_WALL_STONE:
chance += 5;
break;
case StaticObjects.OBJECT_NUMBER_WALL_IRON:
chance -= 15;
break;
default:
ch.SendText("That wasn't exactly designed for climbing.\r\n");
return;
}
// Maximum chance of 98%
if (chance > 98)
{
chance = 98;
}
if (MUDMath.NumberPercent() >= chance)
{
ch.SendText("You try to climb it, but you fall on your ass!\r\n");
ch.CurrentPosition = Position.sitting;
ch.WaitState(5);
return;
}
ch.SendText("With great skill, you scale the wall!\r\n");
// Value 0 of a wall object is the direction that has been walled...
// This means that they should move in that direction. We leave it up to
// move_char to make sure that there is actually an exit in that direction.
// we use the climbing bit to allow them to pass the walls in move_char.
ch.SetAffectBit(Affect.AFFECT_CLIMBING);
ch.Move((Exit.Direction)obj.Values[0]);
ch.RemoveAffect(Affect.AFFECT_CLIMBING);
return;
}