本文整理汇总了C#中MUDEngine.CharData.IsAwake方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.IsAwake方法的具体用法?C# CharData.IsAwake怎么用?C# CharData.IsAwake使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.IsAwake方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Wake
/// <summary>
/// Wake one's self or someone else.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Wake(CharData ch, string[] str)
{
if( ch == null ) return;
string arg = String.Empty;
if (ch.IsAwake())
{
ch.SendText("You are already awake.\r\n");
return;
}
if (str.Length == 0 || String.IsNullOrEmpty(str[0]) ||
str[0].Equals("me", StringComparison.CurrentCultureIgnoreCase) && ch.CurrentMana > 0)
{
Stand(ch, str);
return;
}
if (!ch.IsAwake())
{
ch.SendText("You are asleep yourself!\r\n");
return;
}
CharData victim = ch.GetCharRoom(arg);
if (victim == null)
{
ch.SendText("They aren't here.\r\n");
return;
}
if (victim.IsAwake())
{
SocketConnection.Act("$N&n is already awake.", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
if (victim.IsAffected(Affect.AFFECT_SLEEP))
{
SocketConnection.Act("You can't wake $M!", ch, null, victim, SocketConnection.MessageTarget.character);
return;
}
victim.CurrentPosition = Position.resting;
SocketConnection.Act("You wake $M.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n wakes you.", ch, null, victim, SocketConnection.MessageTarget.victim);
return;
}
示例2: SpellupOthers
static bool SpellupOthers( CharData ch )
{
if (ch == null) return false;
if (ch.InRoom.HasFlag(RoomTemplate.ROOM_NO_MAGIC))
return false;
if( !ch.IsAwake() || ch.Fighting )
return false;
if( !ch.CanSpeak() )
return false;
CharData victim = null;
foreach( CharData ivictim in ch.InRoom.People )
{
if (ivictim != ch && CharData.CanSee(ch, ivictim) && MUDMath.NumberBits(1) == 0 && ivictim.IsNPC())
{
victim = ivictim;
break;
}
}
if( !victim )
return false;
if( victim.Hitpoints < ( victim.GetMaxHit() - 10 ) )
{
if( CheckDefensive( ch, victim, "full heal", 75 ) )
return true;
if( CheckDefensive( ch, victim, "aid", 60 ) )
return true;
if( CheckDefensive( ch, victim, "heal", 75 ) )
return true;
if( CheckDefensive( ch, victim, "mending", 75 ) )
return true;
}
if (!victim.IsAffected(Affect.AFFECT_HASTE))
if( CheckDefensive( ch, victim, "haste", 45 ) )
return true;
return false;
}
示例3: CheckShieldBlock
/// <summary>
/// Checks for block if holding shield.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
static bool CheckShieldBlock( CharData ch, CharData victim )
{
if( !victim.HasSkill( "shield block" ) )
return false;
if( ch.IsAffected( Affect.AFFECT_DAZZLE ) )
return false;
if( !victim.IsAwake() || victim.CurrentPosition < Position.reclining )
return false;
Object obj = Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one );
if( !obj || ( obj.ItemType != ObjTemplate.ObjectType.shield ) )
{
if( !( obj = Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two ) ) )
return false;
if( obj.ItemType != ObjTemplate.ObjectType.shield )
return false;
}
if( obj.ItemType != ObjTemplate.ObjectType.shield )
{
if( !( obj = Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two ) ) )
return false;
if( obj.ItemType != ObjTemplate.ObjectType.shield )
return false;
}
int chance = ch.GetSkillChance("shield block");
victim.PracticeSkill("shield block");
if (MUDMath.NumberPercent() >= ((chance - ch.Level) / 2))
{
return false;
}
switch( MUDMath.NumberRange( 1, 5 ) )
{
case 1:
SocketConnection.Act( "You block $n&n's attack with your shield.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n blocks your attack with a shield.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "$N&n blocks $n&n's attack with a shield.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
case 2:
// If we were really smart we would check to see whether both the shield
// and weapon were made of metal before we gave a sparks message...
SocketConnection.Act( "&+CS&n&+cp&+Car&n&+ck&+Cs&n fly off your shield as you block $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n defends against your attack with a shield.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "$N&n deflects $n&n's attack with a shield.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
case 3:
SocketConnection.Act("You bring up your shield to block $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n brings up %s shield to block your attack.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$N&n brings up %s shield to blocks $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
case 4:
SocketConnection.Act("You knock $n&n's attack aside with your shield.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n knocks your attack aside with $S shield.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$N&n knocks $n&n's attack aside with $S shield.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
case 5:
SocketConnection.Act("You hear a thud as $n&n's weapon smacks into your shield.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("Your weapon smacks into $N&n's shield with a thud.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n's weapon smacks into $N&'s shield with a thud.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
default:
break;
}
if( ch.Fighting == null )
SetFighting( ch, victim );
if( victim.Fighting == null )
SetFighting( victim, ch );
return true;
}
示例4: CheckDodge
/// <summary>
/// Checks whether the victim is able to dodge the attacker's swing.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
public static bool CheckDodge( CharData ch, CharData victim )
{
if( !victim.IsAwake() || victim.CurrentPosition < Position.reclining )
return false;
if (ch.IsAffected(Affect.AFFECT_DAZZLE))
return false;
if( !victim.HasSkill( "dodge" ) )
return false;
int chance = victim.GetSkillChance("dodge");
// Size difference bonus for dodge for halflings - they get 2% dodge
// bonus per size difference between them and the attacker. -- Xangis
// Drow get a flat 15% bonus.
if( victim.GetRace() == Race.RACE_HALFLING )
{
if( ch.CurrentSize > victim.CurrentSize )
{
chance += 3 * ( ch.CurrentSize - victim.CurrentSize );
}
}
else if( victim.HasInnate( Race.RACE_GOOD_DODGE ) )
{
chance += 8;
}
else if( victim.HasInnate( Race.RACE_BAD_DODGE ) )
{
chance -= 3;
}
// Bashed mobs/creatures have a hard time dodging
if( victim.CurrentPosition < Position.fighting )
{
chance -= 25;
}
// Leap is 16% max at level 50. Considering crappy thri hitpoints it's necessary.
if( victim.GetRace() == Race.RACE_THRIKREEN && MUDMath.NumberPercent() <= ( victim.Level / 3 ) )
{
SocketConnection.Act( "$N&n leaps over your attack.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "You leap over $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n leaps over $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
return true;
}
victim.PracticeSkill( "dodge" );
if( MUDMath.NumberPercent() >= chance - ch.Level )
return false;
switch( MUDMath.NumberRange( 1, 2 ) )
{
case 1:
SocketConnection.Act( "$N&n dodges your attack.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "You dodge $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n dodges $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
case 2:
SocketConnection.Act( "$N&n sidesteps your attack.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "You narrowly dodge $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n avoids $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
default:
break;
}
if( ch.Fighting == null )
SetFighting( ch, victim );
if( victim.Fighting == null )
SetFighting( victim, ch );
return true;
}
示例5: CheckRiposte
/// <summary>
/// Checks whether the victim is able to riposte the attacker's swing. Returns false
/// if failed, true if successful.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
static bool CheckRiposte( CharData ch, CharData victim )
{
if( !victim.IsAwake() || victim.CurrentPosition < Position.reclining )
return false;
if( ch.IsAffected( Affect.AFFECT_DAZZLE ) )
return false;
if( ch.IsAffected( Affect.AFFECT_BLIND ) )
return false;
if( ch.IsAffected(Affect.AFFECT_CASTING ) )
return false;
if( !victim.HasSkill( "riposte" ) )
return false;
int chance = ch.GetSkillChance("riposte");
if (victim.IsNPC())
{
// Mobs more often than not don't have weapons
// so they should get bonuses for actually
// having them
if( Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one ) )
{
chance += 3;
}
}
else
{
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one ) )
{
// Have to have a weapon to riposte. If only holding secondary weapon chances are lowered.
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two ))
{
return false;
}
chance /= 2;
}
victim.PracticeSkill( "riposte" );
}
if( MUDMath.NumberPercent() >= (( chance - ch.Level ) / 3 ) )
return false;
switch( MUDMath.NumberRange(1,3))
{
case 1:
SocketConnection.Act( "$N&n deflects your blow and strikes back at YOU!", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "You deflect $n&n's attack and strike back at $m.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n deflects $n&n's attack and strikes back at $m.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
case 2:
SocketConnection.Act("$N&n knocks your swing aside and strikes back at YOU!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("You knock $n&n's attack aside and strikes back at $m.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n knocks $n&n's attack aside and strikes back at $m.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
case 3:
SocketConnection.Act("$N&n blocks your strike and swings back at YOU!", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("You block $n&n's strike aside and swing back at $m.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n block $n&n's strike and swings back at $m.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
}
return true;
}
示例6: CheckParry
/// <summary>
/// Checks whether the victim is able to parry a swing.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
static bool CheckParry( CharData ch, CharData victim )
{
if( !victim.IsAwake() || victim.CurrentPosition < Position.reclining )
return false;
if (ch.IsAffected(Affect.AFFECT_DAZZLE))
return false;
if( !victim.HasSkill( "parry" ) )
return false;
int chance = ch.GetSkillChance("parry");
if (victim.IsNPC())
{
// Mobs more often than not don't have weapons
// so they should get bonuses for actually
// having them
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one ) )
{
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two ) )
chance -= 5;
}
else
chance += 5;
}
else
{
// No weapon means no parry. Only secondary weapon means 50% chance to parry.
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_one ) )
{
if( !Object.GetEquipmentOnCharacter( victim, ObjTemplate.WearLocation.hand_two ) )
return false;
chance /= 2;
}
victim.PracticeSkill( "parry" );
}
if( MUDMath.NumberPercent() >= ( chance - ch.Level ) / 2 )
return false;
switch( MUDMath.NumberRange(1,3))
{
case 1:
SocketConnection.Act( "$N&n skillfully parries your attack.", ch, null, victim, SocketConnection.MessageTarget.character );
SocketConnection.Act( "You parry $n&n's fierce attack.", ch, null, victim, SocketConnection.MessageTarget.victim );
SocketConnection.Act( "$N&n parries $n&n's attack.", ch, null, victim, SocketConnection.MessageTarget.room_vict );
break;
case 2:
SocketConnection.Act("$N&n knocks your blow aside with $S weapon.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("You knock $n&n's clumsy attack aside with your weapon.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n knocks $n&n's attack aside with $S weapon.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
case 3:
SocketConnection.Act("$N&n deflects your attack with $S weapon.", ch, null, victim, SocketConnection.MessageTarget.character);
SocketConnection.Act("You deflect $n&n's attack with your weapon.", ch, null, victim, SocketConnection.MessageTarget.victim);
SocketConnection.Act("$N&n deflects $n&n's attack aside with $S weapon.", ch, null, victim, SocketConnection.MessageTarget.room_vict);
break;
}
if( ch.Fighting == null )
SetFighting( ch, victim );
if( victim.Fighting == null )
SetFighting( victim, ch );
return true;
}
示例7: SingleAttack
//.........这里部分代码省略.........
{
dam = MUDMath.NumberRange(1, (2 + (int)ch.CurrentSize / 3));
if (ch.CheckSkill("unarmed damage"))
{
dam += MUDMath.NumberRange(1, (ch.GetSkillChance("unarmed damage") / 12));
}
}
else
{
int min;
// monk barehanded damage - Xangis
ch.PracticeSkill("unarmed damage");
chance = ch.GetSkillChance("unarmed damage");
if (chance < 13)
{
min = 1;
}
else
{
min = chance / 13;
}
// at max skill for barehanded and unarmed, a monk will get
// a damage of 7-38, an average of 22.5 damage per hit before
// modifiers. This is slightly better than a 6d6 weapon (average of 21 dmg)
// this is slightly worse than a 6d7 weapon (average of 24 dmg)
dam = MUDMath.NumberRange(min, ((chance / 3) + min));
}
}
if( ( wield && dam > 1000 ) && ch.Level < Limits.LEVEL_AVATAR )
{
text = String.Format( "SingleAttack damage range > 1000 from {0} to {1}",
wield.Values[ 1 ], wield.Values[ 2 ] );
Log.Error( text, 0 );
}
}
/*
* Played a character with an armor class of 126 (awful agility).
* Wasn't getting pounded much at all. Added a damage bonus applied
* when the target's ac is worse than 100.
*
* This also means that someone who makes their weapon proficiency
* check against someone with an ac of 81 or higher will also get a
* damage bonus of 1% per ac point.
*
* This applies to mobs too, so if a mob has a terrible AC it will
* get whacked harder. I call this the "soft as a pudding" code.
*
* This would also make AC debuffs stronger if they can make ac worse
* than 100.
*/
if( victimAC > 100 )
{
dam += ( (victimAC - 100) * dam) / 100;
}
/*
* Bonuses.
*/
dam += ch.GetDamroll( weapon );
/* Weapon proficiencies, players only */
/* Up to 50% increase based on weapon skill */
if (wield && !ch.IsNPC())
{
dam += dam * ch.GetSkillChance(weaponGsn) / 180;
}
/* Up to 33% for offense skill */
/* This means someone that has mastered a weapon and offense
automatically does double damage in combat */
chance = ch.GetSkillChance("offense");
dam += dam * chance / 270;
/* Bad idea to get caught napping in a fight */
if( !victim.IsAwake() )
dam *= 2;
/* Backstab: 2 + one per 9 levels, 7x damage at 50 */
if (skill == "backstab")
{
// Cap was previously too low. It has been raised because a merc that was previously
// stabbing for 180 now stabs for 64. Assassins will still be able to stab for
// 175 and mercs for 116 with this revised cap. Keep in mind that a sorc can easily
// fist for 250.
int cap = 100 + 12 * ch.Level;
if( ch.IsClass(CharClass.Names.mercenary) || ch.IsClass(CharClass.Names.bard ))
cap = cap * 2 / 3;
dam *= ( 2 + ( ch.Level / 9 ) );
/* damage cap applied here */
dam = Math.Min( dam, cap );
}
else if (skill == "circle") /* 150% to 200% at lev. 50 */
dam += dam / 2 + ( dam * ch.Level ) / 100;
if( dam <= 0 )
dam = 1;
return InflictDamage(ch, victim, dam, skill, weapon, damType);
}
示例8: InflictSpellDamage
//.........这里部分代码省略.........
victim.SendText( "&+LYou are stunned, but will probably recover.&n\r\n" );
SocketConnection.Act( "$n&+L is stunned, but will probably recover.&n",
victim, null, null, SocketConnection.MessageTarget.room, true );
break;
case Position.dead:
SocketConnection.Act( spell.MessageKill, ch, null, victim, SocketConnection.MessageTarget.room_vict );
SocketConnection.Act( spell.MessageKill, ch, null, victim, SocketConnection.MessageTarget.character );
if( victim == ch )
{
victim.SendText( "&+LYou have been &+Rsl&n&+ra&+Ri&n&+rn&+L!&n\r\n\r\n" );
}
else
{
string buf = String.Format( "&+LYou have been &+Rsl&n&+ra&+Ri&n&+rn&+L by&n {0}&+L!&n\r\n\r\n",
ch.ShowNameTo( victim, false ) );
victim.SendText( buf );
}
StopFighting( victim, true );
SocketConnection.Act( "$n&+L is &n&+rdead&+L!&n", victim, null, null, SocketConnection.MessageTarget.room, true );
break;
default:
if( dam > victim.GetMaxHit() / 5 )
victim.SendText( "That really did &+RHURT&n!\r\n" );
if( victim.Hitpoints < victim.GetMaxHit() / 10 )
victim.SendText( "You sure are &n&+rBL&+RE&n&+rE&+RDI&n&+rN&+RG&n!\r\n" );
break;
}
/*
* Sleep spells and extremely wounded folks.
*/
if( !victim.IsAwake() ) /* lets make NPC's not slaughter PC's */
{
if( victim.Fighting
&& victim.Fighting.Hunting
&& victim.Fighting.Hunting.Who == victim )
StopHunting( victim.Fighting );
if( victim.Fighting
&& !victim.IsNPC()
&& ch.IsNPC() )
StopFighting( victim, true );
else
StopFighting( victim, false );
}
/*
* Payoff for killing things.
*/
if( victim.CurrentPosition == Position.dead )
{
StopFighting( ch, false );
if( !victim.HasActionBit(MobTemplate.ACT_NOEXP ) || !victim.IsNPC() )
GroupExperienceGain( ch, victim );
if( !victim.IsNPC() )
{
if( ch.IsNPC() )
{
( (PC)victim ).MobDeaths++;
if( victim.IsGuild() )
{
( (PC)victim ).GuildMembership.MonsterDeaths++;
( (PC)victim ).GuildMembership.Score += CalculateDeathScore( ch, victim );
示例9: InflictDamage
//.........这里部分代码省略.........
if( victim == ch )
{
victim.SendText( "&+LYou have been &+Rsl&n&+ra&+Ri&n&+rn&+L!&n\r\n\r\n" );
}
else
{
string buf = String.Format( "&+LYou have been &+Rsl&n&+ra&+Ri&n&+rn&+L by&n {0}&+L!&n\r\n\r\n",
ch.ShowNameTo( victim, false ) );
victim.SendText( buf );
}
/* Added this to stop a bug. */
Combat.StopFighting( victim, true );
SocketConnection.Act( "$n&+L is &n&+rdead&+L!&n", victim, null, null, SocketConnection.MessageTarget.room, true );
break;
default:
if( dam > victim.GetMaxHit() / 5 )
victim.SendText( "That really did &+RHURT&n!\r\n" );
if( victim.Hitpoints < victim.GetMaxHit() / 10 )
victim.SendText( "You sure are &n&+rBL&+RE&n&+rE&+RDI&n&+rN&+RG&n!\r\n" );
break;
}
// Check for weapon procs
if( ( obj = Object.GetEquipmentOnCharacter( ch, weapon ) ) && Position.dead != victim.CurrentPosition )
{
if( obj.SpecFun.Count > 0 )
obj.CheckSpecialFunction(true);
}
/*
* Sleep spells and extremely wounded folks.
*/
if( !victim.IsAwake() ) /* lets make NPC's not slaughter PC's */
{
if( victim.Fighting
&& victim.Fighting.Hunting
&& victim.Fighting.Hunting.Who == victim )
StopHunting( victim.Fighting );
if( victim.Fighting
&& !victim.IsNPC()
&& ch.IsNPC() )
StopFighting( victim, true );
else
StopFighting( victim, false );
}
/*
* Payoff for killing things.
*/
if( victim.CurrentPosition == Position.dead )
{
// Done in attempt to squelch the combat continuation bug
StopFighting( victim, true );
if( !victim.HasActionBit(MobTemplate.ACT_NOEXP ) || !victim.IsNPC() )
GroupExperienceGain( ch, victim );
if( ch.IsNPC() )
{
if( ch.Hunting )
{
if( ch.Hunting.Who == victim )
StopHunting( ch );
}
if( ch.IsHating(victim) )