本文整理汇总了C#中MUDEngine.CharData.GetCurrLuck方法的典型用法代码示例。如果您正苦于以下问题:C# CharData.GetCurrLuck方法的具体用法?C# CharData.GetCurrLuck怎么用?C# CharData.GetCurrLuck使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUDEngine.CharData
的用法示例。
在下文中一共展示了CharData.GetCurrLuck方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Attributes
//.........这里部分代码省略.........
buf = String.Format(
"&+WHeight:&n {0} inches &+WWeight:&n {1} pounds &+WSize:&n {2}\r\n",
MUDString.PadInt(((PC)ch).Height, 3),
MUDString.PadInt(((PC)ch).Weight, 5),
Race.SizeString(ch.CurrentSize));
}
else
{
buf = String.Format("&+WSize:&n {0}\r\n", ch.CurrentSize);
}
buf1 += buf;
TimeSpan time = TimeSpan.FromTicks(ch.TimePlayed.Ticks) + (DateTime.Now - ch.LogonTime);
int days = (int)time.TotalHours / 24;
time = (time - TimeSpan.FromDays(days));
int hours = (int)time.TotalHours;
time = (time - TimeSpan.FromHours(hours));
int minutes = (int)time.TotalMinutes;
// Age is a hack until we get it coded - Xangis
buf = String.Format(
"\r\n&+BAge:&n {0} years. &+BPlaying Time:&n {1} days {2} hours {3} minutes.\r\n",
MUDString.PadInt(ch.GetAge(), 3), days, hours, minutes);
buf1 += buf;
// Need to create a function to display character status strings
buf = String.Format("&+BStatus:&n {0}", System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(Position.PositionString(ch.CurrentPosition)));
if (!ch.IsNPC() && ch.IsAffected(Affect.AFFECT_BERZERK))
{
buf += ", &+Rberzerk&n";
}
if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEMORIZING))
{
buf += ", Memorizing";
}
if (ch.IsAffected(Affect.AFFECT_CASTING))
{
buf += ", Casting";
}
if (ch.IsAffected(Affect.AFFECT_SINGING))
{
buf += ", Singing";
}
if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_MEDITATING))
{
buf += ", Meditating";
}
if (!ch.IsNPC() && ch.HasActionBit(PC.PLAYER_CAMPING))
{ /* This is ugly and should be moved to its own function */
buf += ", Camping";
}
buf += ".\r\n\r\n";
buf1 += buf;
// We want players to see the same stats for levels 1-50.
// Should create string converters so that we have no decimals displayed
// below this point.
buf = String.Format(" &+cSTR:&n {0} &+cArmor Class:&n {1}.\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrStr()), 15), ch.GetAC());
buf1 += buf;
buf = String.Format(" &+cAGI:&n {0} &+cHitroll:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrAgi()), 15), StringConversion.BonusString(ch.GetHitroll(ObjTemplate.WearLocation.hand_one)));
buf1 += buf;
buf = String.Format(" &+cDEX:&n {0} &+cDamroll:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrDex()), 15), StringConversion.BonusString(ch.GetDamroll(ObjTemplate.WearLocation.hand_one)));
buf1 += buf;
buf = String.Format(" &+cCON:&n {0} &+cAlignment:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrCon()), 15), StringConversion.AlignmentString(ch));
buf1 += buf;
buf = String.Format(" &n&+cINT:&n {0}\r\n", MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrInt()), 15));
buf1 += buf;
buf = String.Format(" &+cWIS:&n {0} &+BSaving Throws&n\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrWis()), 15));
buf1 += buf;
buf = String.Format(" &+cPOW:&n {0} &+cParalysis:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrPow()), 15), StringConversion.BonusString(-ch.SavingThrows[0]));
buf1 += buf;
buf = String.Format(" &+cCHA:&n {0} &+cRod:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrCha()), 15), StringConversion.BonusString(-ch.SavingThrows[1]));
buf1 += buf;
buf = String.Format(" &+cLUK:&n {0} &+cPetrify:&n {1}\r\n",
MUDString.PadStr(StringConversion.AbilityScoreString(ch.GetCurrLuck()), 15), StringConversion.BonusString(-ch.SavingThrows[2]));
buf1 += buf;
buf = String.Format(" &+cBreath:&n {0}\r\n",
StringConversion.BonusString(-ch.SavingThrows[3]));
buf1 += buf;
buf = String.Format("&+BWimpy: &n{0} &+cSpell:&n {1}\r\n",
MUDString.PadInt(ch.Wimpy, 4), StringConversion.BonusString(-ch.SavingThrows[4]));
buf1 += buf;
buf = String.Format("&+BLoad Carried: &n{0} pounds ({1})\r\n",
MUDString.PadInt(ch.CarryWeight, 3), StringConversion.WeightString(ch));
buf1 += buf;
ch.SendText(buf1);
return;
}
示例2: Forage
/// <summary>
/// Search the local area for food.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Forage(CharData ch, string[] str)
{
if( ch == null ) return;
int indexNumber;
Object obj = null;
int[] flist = new int[10] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 25 };
if (!ch.InRoom)
{
ch.SendText("There's no foraging to be done here.\r\n");
return;
}
if (ch.FlightLevel != 0)
{
ch.SendText("Right, you're going to find something way up here.\r\n");
return;
}
int chance = 10 + (ch.GetCurrLuck() / 20);
if (ch.IsClass(CharClass.Names.ranger) || ch.IsClass(CharClass.Names.hunter) || ch.IsImmortal())
chance = 75;
if (chance < MUDMath.NumberPercent())
{
ch.SendText("You don't find anything at all.\r\n");
ch.Wait += 10;
return;
}
ch.Wait += 15;
TerrainType sector = ch.InRoom.TerrainType;
// TODO: FIXME: Don't use hard-coded item numbers!
switch (sector)
{
default:
ch.SendText("Nothing edible could be growing here.\r\n");
return;
case TerrainType.field:
flist[0] = 80;
flist[1] = 84;
flist[2] = 86;
flist[6] = 91;
flist[7] = 80;
break;
case TerrainType.hills:
flist[0] = 82748;
flist[1] = 86;
flist[2] = 92;
flist[6] = 94;
break;
case TerrainType.underground_wild:
flist[0] = 3352;
flist[5] = 3352;
flist[6] = 7711;
flist[1] = 85;
flist[2] = 88;
flist[7] = 82;
flist[8] = 83;
break;
case TerrainType.swamp:
flist[0] = 3352;
flist[1] = 88;
flist[5] = 94;
flist[6] = 83;
flist[7] = 89;
break;
case TerrainType.forest:
flist[0] = 2057;
flist[1] = 81651;
flist[2] = 90;
flist[3] = 93;
flist[4] = 92;
flist[5] = 90;
flist[6] = 87;
flist[7] = 84;
break;
} //end switch
if (ch.IsClass(CharClass.Names.ranger) || ch.IsClass(CharClass.Names.hunter))
indexNumber = flist[MUDMath.NumberRange(0, 9)];
else
indexNumber = flist[MUDMath.NumberRange(0, 4)];
if (indexNumber == 0)
{
ch.SendText("You find nothing edible.\r\n");
return;
}
string buf = String.Format("Forage: {0} found index number {1} in room {2}.", ch.Name, indexNumber, ch.InRoom.IndexNumber);
ImmortalChat.SendImmortalChat(null, ImmortalChat.IMMTALK_SPAM, 0, buf);
/*
if (fvnum == StaticObjects.OBJECT_NUMBER_SPRING) {
//don't allow endless springs
for ( obj = ch.in_room.contents; obj; obj = obj.next_content ) {
if (obj.pIndexData.vnum == fvnum) {
Descriptor._actFlags("You notice the $p&n.", ch, obj, null, Descriptor.MessageTarget.character);
return;
}
//.........这里部分代码省略.........
示例3: 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;
//.........这里部分代码省略.........
示例4: Search
/// <summary>
/// Try to find hidden things.
/// </summary>
/// <param name="ch"></param>
/// <param name="str"></param>
public static void Search(CharData ch, string[] str)
{
if( ch == null ) return;
Room toRoom;
Exit reverseExit;
Exit exit = null;
Object obj;
bool isArg;
Exit.Direction door;
if (ch.InRoom == null)
{
ch.SendText("There's no searching to be done here.\r\n");
return;
}
/* Calculate the probability that ch finds something. */
int chance = ch.GetCurrInt() * 35 / 100;
chance += ch.GetCurrWis() * 35 / 100;
chance += ch.GetCurrLuck() * 10 / 100;
// Dwarves, being natural architects, can search better - Xangis
if (ch.GetRace() == Race.RACE_DWARF)
chance += 25;
if (chance > 95)
chance = 95;
if (chance < 10)
chance = 10;
/* Searching with arguments. */
if (str.Length != 0)
{
isArg = true;
obj = ch.GetObjHere(str[0]);
if (obj == null)
{
ch.SendText("You don't see that object here.\r\n");
return;
}
switch (obj.ItemType)
{
case ObjTemplate.ObjectType.quiver:
case ObjTemplate.ObjectType.container:
case ObjTemplate.ObjectType.npc_corpse:
case ObjTemplate.ObjectType.pc_corpse:
if (Macros.IsSet(obj.Values[1], ObjTemplate.CONTAINER_CLOSED.Vector))
{
SocketConnection.Act("$p&n is closed.", ch, obj, null, SocketConnection.MessageTarget.character);
return;
}
break;
default:
ch.SendText("That is not a container!\r\n");
return;
}
}
else
{
isArg = false;
obj = null;
}
/* Lag ch from searching. */
if (ch.Level < Limits.LEVEL_AVATAR)
{
ch.WaitState(MUDMath.FuzzyNumber(18));
}
List<Object> list;
if (obj != null)
{
list = obj.Contains;
}
else
{
list = ch.InRoom.Contents;
}
foreach (Object obj2 in list)
{
if (obj2.HasFlag(ObjTemplate.ITEM_SECRET) && chance > MUDMath.NumberPercent()
&& obj2.FlyLevel == ch.FlightLevel)
{
obj2.RemoveFlag(ObjTemplate.ITEM_SECRET);
SocketConnection.Act("You find $p&n.", ch, obj2, null, SocketConnection.MessageTarget.character);
SocketConnection.Act("$n&n points out $p&n!", ch, obj, null, SocketConnection.MessageTarget.room);
return;
}
}
/* Look for a hidden exit. */
door = Exit.Direction.invalid;
for (int doornum = 0; doornum <= Limits.MAX_DIRECTION; doornum++)
{
//.........这里部分代码省略.........
示例5: BlurAttack
/// <summary>
/// Processes a blur-type attack. Returns true if the victim died.
/// </summary>
/// <param name="ch"></param>
/// <param name="victim"></param>
/// <returns></returns>
public static bool BlurAttack( CharData ch, CharData victim )
{
if (ch == null) return false;
int numAttacks;
int count;
if( ch.IsAffected( Affect.AFFECT_CASTING ) )
{
return false;
}
if( ch.IsAffected( Affect.AFFECT_BLUR ) && MUDMath.NumberPercent() < 25 )
{
SocketConnection.Act( "$n&n moves with a BLUR of speed!", ch, null, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "You move with a BLUR of speed!", ch, null, null, SocketConnection.MessageTarget.character );
for( count = 0, numAttacks = 4; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
{
SingleAttack( ch, victim, String.Empty, ObjTemplate.WearLocation.hand_one );
}
}
else
{
Object wield;
if( MUDMath.NumberPercent() > 10 )
return false;
if( ch.IsClass(CharClass.Names.hunter) || ch.IsClass(CharClass.Names.ranger ))
numAttacks = 2;
else if( ch.GetRace() == Race.RACE_OGRE || ch.GetRace() == Race.RACE_CENTAUR )
numAttacks = 4;
else
numAttacks = 9;
if( MUDMath.NumberPercent() < ch.GetCurrLuck() )
numAttacks++;
if( MUDMath.NumberPercent() < victim.GetCurrLuck() )
numAttacks--;
/* 9716 is the index number for the dagger of the wind. */
// HORRIBLE HORRIBLE TODO: FIXME: BUG: Never hard-code item index numbers.
if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_one ) ) && wield.ObjIndexData.IndexNumber == 9716 )
{
SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
{
SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_one);
}
return ( victim.CurrentPosition > Position.dead );
}
if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_two ) ) && wield.ObjIndexData.IndexNumber == 9716 )
{
SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
{
SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_two);
}
return ( victim.CurrentPosition > Position.dead );
}
if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_three ) ) && wield.ObjIndexData.IndexNumber == 9716 )
{
SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
{
SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_three);
}
return ( victim.CurrentPosition > Position.dead );
}
if( ( wield = Object.GetEquipmentOnCharacter( ch, ObjTemplate.WearLocation.hand_four ) ) && wield.ObjIndexData.IndexNumber == 9716 )
{
SocketConnection.Act( "&+c$n&+c's $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.room );
SocketConnection.Act( "Your $p&n &+cbegins to move with the &+Wspeed&+c of a &+lstorm&+c!&n", ch, wield, null, SocketConnection.MessageTarget.character );
for( count = 0; count < numAttacks && victim.CurrentPosition > Position.dead; ++count )
{
SingleAttack(ch, victim, String.Empty, ObjTemplate.WearLocation.hand_four);
}
return ( victim.CurrentPosition > Position.dead );
}
}
return false;
}
示例6: SingleAttack
//.........这里部分代码省略.........
* version in the definitions. This is stupid.
*/
if( wield && wield.ItemType == ObjTemplate.ObjectType.weapon )
{
if( !wield.HasFlag( ObjTemplate.ITEM_TWOHANDED ) )
{
if( ch.CheckSkill( weaponGsn ))
{
victimAC += 20;
ch.PracticeSkill( weaponGsn );
}
}
else
{
// This is not going to work.
if (ch.CheckSkill(weaponGsn+1))
{
victimAC += 20;
ch.PracticeSkill(weaponGsn);
}
}
}
else if( ch.CheckSkill("barehanded fighting"))
{
victimAC += 20;
}
/*
* The moment of excitement!
*/
int diceroll = MUDMath.NumberRange( 0, 199 );
// Give them a small bonus if they can make a successful luck check.
if( MUDMath.NumberPercent() <= ch.GetCurrLuck() )
diceroll += 5;
/* Made really lucky chars get saved by the godz. */
if( diceroll == 0 || ( diceroll <= 196 && diceroll < hitroll - victimAC )
|| ( MUDMath.NumberPercent() < victim.GetCurrLuck() / 40 ) )
{
/* Miss. */
return InflictDamage(ch, victim, 0, skill, weapon, damType);
}
/*
* Hit.
* Calc damage.
*
* NPCs are more badass barehanded than players. If they weren't
* the game would be too damned easy since mobs almost never have
* weapons.
*
* Increased mob damage by about 1/6
* It was previously level/2 to level*3/2 (25-75 at 50, average 50)
* It is now level*3/5 to level*10/6 (30-87 at 50, average 59)
*
* Added the + ch.level - 1 'cause mobs still not hittin' hard enough
*/
if( ch.IsNPC() )
{
dam = MUDMath.NumberRange( ( ch.Level * 3 / 5 ), ( ch.Level * 14 / 8 ) )
+ ( ch.Level - 1 );
if (wield)
{
dam += MUDMath.Dice(wield.Values[1], wield.Values[2]);
}
示例7: InflictDamage
//.........这里部分代码省略.........
&& victim.Master.InRoom == ch.InRoom
&& MUDMath.NumberBits( 2 ) == 0 )
{
StartGrudge( ch, victim.Master, false );
}
}
/*
* More charm stuff.
*/
if( victim.Master == ch )
{
StopFighting( victim, true );
}
ch.BreakInvisibility();
/*
* Hunting stuff...
*/
if( dam != 0 && victim.IsNPC() )
{
/* StartGrudge is combined StartHating and StartHunting */
StartGrudge( victim, ch, false );
}
/*
* Damage modifiers.
*/
// Critical hits for double damage
// Average of 5% for those that have average luck
// Gnomes could concievably have 10%
if( MUDMath.NumberPercent() < ( 2 + ( ch.GetCurrLuck() / 18 ) ) && dam > 0 )
{
ch.SendText( "&+WYou score a CRITICAL HIT!&n\r\n" );
dam *= 2;
critical = true;
}
if( victim.IsAffected( Affect.AFFECT_SANCTUARY ) )
dam /= 2;
if( victim.IsAffected( Affect.AFFECT_PROTECT_EVIL ) && ch.IsEvil() )
dam -= dam / 8;
else if( victim.IsAffected( Affect.AFFECT_PROTECT_GOOD ) && ch.IsGood() )
dam -= dam / 8;
// Check stoneskin. People not affected by a stoneskin affect
// cannot lose their stoneskin for any reason. This should mean
// that mobs will keep their stoneskin and players should always
// have a chance to lose it, since no player should ever be
// setbit stoneskin.
//
// The bool value of found is used so that we can have them
// take full damage when their stoneskin shatters, but get the
// damage reduction if they are either a mob or their stoneskin
// wears off that round.
//
/* Yeah, yeah.. so maybe backstabs shouldn't be aff'd. */
// Actually they should be affected, but they should have a much
// higher chance of getting through (say 30-70%).
//
// Critical hits will now go through stoneskin
// automatically
if (!critical && victim.IsAffected( Affect.AFFECT_STONESKIN) &&