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; }
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; }
public static void Fortitude(CharData ch, string[] str) { if( ch == null ) return; string arg = String.Empty; int amount; if (ch.IsNPC() || ((PC)ch).SkillAptitude["fortitude"] == 0) { ch.SendText("Try all you will, but you're still your plain self.\r\n"); return; } if (!MUDString.StringsNotEqual(arg, "off")) { if (ch.HasAffect( Affect.AffectType.skill, "fortitude")) { //strip the affect ch.AffectStrip( Affect.AffectType.skill, "fortitude"); } else { ch.SendText("You are not using fortitude.\r\n"); } return; } if (((PC)ch).SkillAptitude["fortitude"] >= 95) amount = 15; else if (((PC)ch).SkillAptitude["fortitude"] >= 60) amount = 10; else amount = 5; Affect af = new Affect(Affect.AffectType.skill, "fortitude", 5 * ch.Level, Affect.Apply.constitution, amount, Affect.AFFECT_NONE); ch.AddAffect(af); ch.SendText("You feel more fortified.\r\n"); }
public static void Charm(CharData ch, string[] str) { if( ch == null ) return; string arg = String.Empty; int amount; if (!ch.HasSkill("charm of the otter")) { ch.SendText("Try all you will, but you're still your plain self.\r\n"); return; } if (!MUDString.StringsNotEqual(arg, "off")) { if (ch.HasAffect( Affect.AffectType.skill, "charm of the otter")) { //strip the affect ch.AffectStrip( Affect.AffectType.skill, "charm of the otter"); } else { ch.SendText("You are not using charm of the otter.\r\n"); } return; } if (((PC)ch).SkillAptitude["charm of the otter"] >= 95) amount = 15; else if (((PC)ch).SkillAptitude["charm of the otter"] >= 60) amount = 10; else amount = 5; Affect af = new Affect(Affect.AffectType.skill, "charm of the otter", 5 * ch.Level, Affect.Apply.charisma, amount, Affect.AFFECT_NONE); ch.AddAffect(af); ch.SendText("You feel more charasmatic!\r\n"); }
public static void Endurance(CharData ch, string[] str) { if( ch == null ) return; string arg = String.Empty; int amount; if (ch.IsNPC() || ((PC)ch).SkillAptitude["endurance"] == 0) { ch.SendText("Try all you will, but you're still your plain self.\r\n"); return; } if (!MUDString.StringsNotEqual(arg, "off")) { if (ch.HasAffect( Affect.AffectType.skill, "endurance")) { //strip the affect ch.AffectStrip( Affect.AffectType.skill, "endurance"); } else { ch.SendText("You are not using endurance.\r\n"); } return; } if (((PC)ch).SkillAptitude["endurance"] >= 95) amount = 15; else if (((PC)ch).SkillAptitude["endurance"] >= 60) amount = 10; else amount = 5; Affect af = new Affect(Affect.AffectType.skill, "endurance", 5 * ch.Level, Affect.Apply.move, amount, Affect.AFFECT_MOVEMENT_INCREASED); ch.AddAffect(af); ch.SendText("You feel the endurance of the mountains in your muscles!\r\n"); }
/// <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; }
/// <summary> /// Innate mount summoning command for antipaladins and paladins. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void SummonMount(CharData ch, string[] str) { MobTemplate mobTemplate; Affect af = new Affect(); int mountNumber = ch.CharacterClass.CanSummonMountNumber; if (mountNumber == 0) { ch.SendText("You scream and yell for a mount. Strangely nothing comes.\r\n"); return; } if (ch.IsAffected( Affect.AFFECT_SUMMON_MOUNT_TIMER)) { ch.SendText("&nIt is too soon to accomplish that!\r\n"); return; } // Look to see if they already have a mount. foreach (CharData previousMount in Database.CharList) { if (previousMount.Master == ch && previousMount.IsNPC() && previousMount.MobileTemplate != null && (previousMount.MobileTemplate.IndexNumber == mountNumber)) { ch.SendText("You already have a mount!\r\n"); return; } } // If not let found, them summon one. mobTemplate = Database.GetMobTemplate(mountNumber); if (mobTemplate == null) { Log.Error("SummonMount: Invalid MobTemplate!", 0); return; } CharData mount = Database.CreateMobile(mobTemplate); // Simulate the poor mount running across the world. // They arrive with partially depleted moves. mount.CurrentMoves -= MUDMath.Dice(4, 40); CharData.AddFollower(mount, ch); mount.SetAffectBit(Affect.AFFECT_CHARM); mount.SetActionBit(MobTemplate.ACT_NOEXP); mount.AddToRoom(ch.InRoom); ch.WaitState(MUDMath.FuzzyNumber(Skill.SkillList["summon mount"].Delay)); SocketConnection.Act("$n&n trots up to you.", mount, null, ch, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n trots up to $N&n.", mount, null, ch, SocketConnection.MessageTarget.everyone_but_victim); if (ch.IsImmortal()) { return; } af.Value = "summon mount"; af.Type = Affect.AffectType.skill; af.Duration = 48; af.SetBitvector(Affect.AFFECT_SUMMON_MOUNT_TIMER); ch.AddAffect(af); return; }
public static void Savvy(CharData ch, string[] str) { if( ch == null ) return; string arg = String.Empty; int amount; if (ch.IsNPC() || ((PC)ch).SkillAptitude["savvy"] == 0) { ch.SendText("Try all you will, but you're still your plain self.\r\n"); return; } if (!MUDString.StringsNotEqual(arg, "off")) { if (ch.HasAffect( Affect.AffectType.skill, "savvy")) { //strip the affect ch.AffectStrip( Affect.AffectType.skill, "savvy"); } else { ch.SendText("You are not using savvy.\r\n"); } return; } if (((PC)ch).SkillAptitude["savvy"] >= 95) amount = 15; else if (((PC)ch).SkillAptitude["savvy"] >= 60) amount = 10; else amount = 5; Affect af = new Affect(Affect.AffectType.skill, "savvy", 5 * ch.Level, Affect.Apply.strength, amount, Affect.AFFECT_STRENGTH_INCREASED); ch.AddAffect(af); ch.SendText("You feel more savvy.\r\n"); }
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; }
public static void Berzerk(CharData ch, string[] str) { if( ch == null ) return; Affect af = new Affect(); /* Don't allow charmed mobs to do this, check player's level */ if ((ch.IsNPC() && ch.IsAffected( Affect.AFFECT_CHARM)) || (!ch.IsNPC() && !ch.HasSkill("berzerk"))) { ch.SendText("You're not enough of a warrior to enter a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n.\r\n"); return; } if (ch.IsAffected(Affect.AFFECT_BERZERK)) { if (MUDMath.NumberPercent() + 10 > ((PC)ch).SkillAptitude["berzerk"]) { ch.SendText("You failed to calm yourself down!\r\n"); ch.WaitState(Skill.SkillList["berzerk"].Delay); return; } ch.SendText("You no longer see targets everywhere.\r\n"); ch.RemoveAffect(Affect.AFFECT_BERZERK); ch.WaitState(Skill.SkillList["berzerk"].Delay); return; } ch.SendText("Your slam your weapon into yourself and &+Rbl&n&+ro&+Ro&n&+rd&n splatters all over!\r\n"); ch.SendText("The sight of &+Rbl&n&+ro&+Ro&n&+rd&n begins to drive you crazy!\r\n"); if (ch.CheckSkill("berzerk")) { af.Value = "berzerk"; af.Type = Affect.AffectType.skill; af.Duration = MUDMath.Dice(1, 2); af.AddModifier( Affect.Apply.hitroll, Math.Max(ch.Level / 6, 2)); af.AddModifier( Affect.Apply.damroll, Math.Max(ch.Level / 6, 2)); af.AddModifier( Affect.Apply.ac, (ch.Level / 2)); af.AddModifier( Affect.Apply.max_constitution, MUDMath.Dice(5, 9)); af.AddModifier( Affect.Apply.agility, 0 - MUDMath.Dice(5, 9)); af.AddModifier( Affect.Apply.max_strength, MUDMath.Dice(5, 9)); af.SetBitvector(Affect.AFFECT_BERZERK); ch.AddAffect(af); ch.SendText("You are overcome by &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!\r\n"); SocketConnection.Act("$n has slipped into a &+RBl&n&+ro&+Ro&n&+rd&+L Rage&n!!", ch, null, null, SocketConnection.MessageTarget.room); return; } ch.SendText("You get a little angry, but fail to call up a &+Rblood rage&n.\r\n"); return; }
/// <summary> /// Paladin "lay hands" healing command. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void LayHands(CharData ch, string[] str) { if( ch == null ) return; Affect af = new Affect(); if (ch.Level <= Limits.LEVEL_AVATAR && !ch.IsClass(CharClass.Names.paladin)) { ch.SendText("&nYou aren't holy enough to do that!\r\n"); return; } if (ch.IsAffected(Affect.AFFECT_LAYHANDS_TIMER)) { ch.SendText("&nIt is too soon to accomplish that!\r\n"); return; } if (str.Length == 0) { ch.SendText("&nLayhands on whom?\r\n"); return; } CharData victim = ch.GetCharRoom(str[0]); if (!victim) { ch.SendText("&nThey're not here.\r\n"); return; } if (victim != ch && ch.Fighting) { ch.SendText("&nYou can only layhands on yourself while fighting.\r\n"); return; } if (victim.Hitpoints < victim.GetMaxHit()) victim.Hitpoints = Math.Min(victim.Hitpoints + 300, victim.GetMaxHit()); victim.UpdatePosition(); if (ch != victim) { SocketConnection.Act("You lay your hands upon $N.", ch, null, victim, SocketConnection.MessageTarget.character); SocketConnection.Act("$n&n lays $s hands upon you.", ch, null, victim, SocketConnection.MessageTarget.victim); SocketConnection.Act("$n&n lays $s hands upon $N&n.", ch, null, victim, SocketConnection.MessageTarget.everyone_but_victim); } else { ch.SendText("&nYou layhands upon yourself.\r\n"); SocketConnection.Act("$n&n lays hands upon $mself&n.", ch, null, null, SocketConnection.MessageTarget.room); } victim.SendText("&+WYou feel a warm glow!&n\r\n"); if (ch.Level >= Limits.LEVEL_AVATAR) return; af.Value = "layhands timer"; af.Type = Affect.AffectType.skill; af.Duration = 24; af.SetBitvector(Affect.AFFECT_LAYHANDS_TIMER); ch.AddAffect(af); }
/// <summary> /// Innate command. Shows and activates innate abilitiies. /// </summary> /// <param name="ch"></param> /// <param name="str"></param> public static void Innate(CharData ch, string[] str) { if( ch == null ) return; string text; Affect af = new Affect(); // Use innates here if (str.Length > 0 && !String.IsNullOrEmpty(str[0])) { if (!MUDString.IsPrefixOf(str[0], "strength")) { if (ch.HasInnate(Race.RACE_STRENGTH)) { if (ch.IsAffected(Affect.AFFECT_STRENGTH_INCREASED)) { ch.SendText("You are already affected by strength."); return; } if (ch.HasInnateTimer(InnateTimerData.Type.strength)) { ch.SendText("You need to rest a bit first.\r\n"); return; } af.Type = Affect.AffectType.spell; af.Value = "strength"; af.Duration = MUDMath.Dice(8, 5); af.AddModifier(Affect.Apply.strength, MUDMath.Dice(2, 4) + 15); af.SetBitvector(Affect.AFFECT_STRENGTH_INCREASED); ch.AddAffect(af); ch.SendText("You feel stronger.\r\n"); ch.AddInnateTimer(InnateTimerData.Type.strength, 24); ch.WaitState(14); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (!MUDString.IsPrefixOf(str[0], "levitate")) { if (ch.HasInnate(Race.RACE_LEVITATE)) { if (ch.IsAffected( Affect.AFFECT_LEVITATE)) { ch.SendText("You are already levitating."); return; } if (ch.HasInnateTimer(InnateTimerData.Type.levitate)) { ch.SendText("You need to rest a bit first.\r\n"); return; } af.Type = Affect.AffectType.spell; af.Value = "levitation"; af.Duration = MUDMath.Dice(8, 5); af.SetBitvector(Affect.AFFECT_LEVITATE); ch.AddAffect(af); ch.SendText("Your feet rise off the ground.\r\n"); ch.AddInnateTimer(InnateTimerData.Type.levitate, 24); ch.WaitState(6); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (!MUDString.IsPrefixOf(str[0], "faerie")) { if (ch.HasInnate(Race.RACE_FAERIE_FIRE)) { CharData victim = ch.GetCharRoom(str[0]); if (victim == null) ch.SendText("You do not see them here."); else { Spell spl = Spell.SpellList["faerie fire"]; if (spl != null) { spl.Invoke(ch, ch.Level, victim); } } } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (!MUDString.IsPrefixOf(str[0], "invisibility")) { if (ch.HasInnate(Race.RACE_INVIS)) { if (ch.IsAffected( Affect.AFFECT_INVISIBLE)) { ch.SendText("You are already invisible!\r\n"); return; } if (ch.HasInnateTimer(InnateTimerData.Type.invisibility)) { ch.SendText("You need to rest a bit first.\r\n"); return; } af.Type = Affect.AffectType.spell; af.Value = "invisibility"; af.Duration = MUDMath.Dice(2, 8) + 4; af.SetBitvector(Affect.AFFECT_INVISIBLE); SocketConnection.Act("$n&n fades out of existence.", ch, null, null, SocketConnection.MessageTarget.room); ch.SendText("You vanish.\r\n"); ch.AddAffect(af); ch.AddInnateTimer(InnateTimerData.Type.invisibility, 24); ch.WaitState(24); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (!MUDString.IsPrefixOf(str[0], "enlarge")) { if (ch.HasInnate(Race.RACE_ENLARGE)) { if (ch.IsAffected(Affect.AFFECT_ENLARGED)) { ch.SendText("You are already enlarged.\r\n"); return; } if (ch.HasInnateTimer(InnateTimerData.Type.enlarge)) { ch.SendText("You need to rest a bit first.\r\n"); return; } af.Type = Affect.AffectType.spell; af.Value = "enlarge"; af.Duration = MUDMath.Dice(8, 5); af.AddModifier(Affect.Apply.size, 1); af.SetBitvector(Affect.AFFECT_NONE); ch.AddAffect(af); ch.SendText("&nYou grow to almost twice your normal size!\r\n"); SocketConnection.Act("$n&n grows to almost twice $s normal size!&n", ch, null, null, SocketConnection.MessageTarget.room); ch.AddInnateTimer(InnateTimerData.Type.enlarge, 24); ch.WaitState(10); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (!MUDString.IsPrefixOf(str[0], "shift")) { if (str.Length > 1 && !MUDString.IsPrefixOf(str[1], "astral")) { if (ch.HasInnate(Race.RACE_SHIFT_ASTRAL)) { if (ch.HasInnateTimer(InnateTimerData.Type.shift_astral)) { ch.SendText("You need to rest a bit first.\r\n"); return; } Spell spell = StringLookup.SpellLookup("plane shift"); if (!spell) { ch.SendText("Something seems to be blocking your ability to shift."); Log.Error("Innate Shift: 'plane shift' spell not found. Check the spells file."); return; } spell.Invoke(ch, ch.Level, new Target(str[1])); ch.AddInnateTimer(InnateTimerData.Type.shift_astral, 8); ch.WaitState(10); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } else if (str.Length > 1 && !MUDString.IsPrefixOf(str[1], "prime")) { if (ch.HasInnate(Race.RACE_SHIFT_PRIME)) { if (ch.HasInnateTimer(InnateTimerData.Type.shift_prime)) { ch.SendText("You need to rest a bit first.\r\n"); return; } Spell spell = StringLookup.SpellLookup("plane shift"); if (!spell) { ch.SendText("Something seems to be blocking your ability to shift."); Log.Error("Innate Shift: 'plane shift' spell not found. Check the spells file."); return; } spell.Invoke(ch, ch.Level, new Target(str[1])); ch.AddInnateTimer(InnateTimerData.Type.shift_prime, 8); ch.WaitState(10); } else { ch.SendText("You don't know how to do that.\r\n"); return; } } } else { ch.SendText("That's not implemented yet. :(\r\n"); } return; } text = String.Format("&+BInnate abilities available to your race and class:&n\r\n"); if (ch.HasInnate(Race.RACE_BODYSLAM)) text += "&n bodyslam\r\n"; if (ch.HasInnate(Race.RACE_CHARGE)) text += "&n charge\r\n"; if (ch.HasInnate(Race.RACE_FLY)) text += "&n fly\r\n"; if (ch.HasInnate(Race.RACE_PASSDOOR)) text += "&n pass door\r\n"; if (ch.HasInnate(Race.RACE_SWIM)) text += "&n swim\r\n"; if (ch.HasInnate(Race.RACE_WATERBREATH)) text += "&n water breathing\r\n"; if (ch.HasInnate(Race.RACE_INFRAVISION)) text += "&n infravision\r\n"; if (ch.HasInnate(Race.RACE_ULTRAVISION)) text += "&n ultravision\r\n"; if (ch.HasInnate(Race.RACE_DETECT_ALIGN) || ch.IsClass(CharClass.Names.antipaladin) || ch.IsClass(CharClass.Names.paladin)) text += "&n detect align\r\n"; if (ch.HasInnate(Race.RACE_DETECT_INVIS)) text += "&n detect invis\r\n"; if (ch.HasInnate(Race.RACE_DETECT_HIDDEN)) text += "&n detect hidden\r\n"; if (ch.HasInnate(Race.RACE_MUTE)) text += "&n mute\r\n"; if (ch.HasInnate(Race.RACE_DOORBASH)) text += "&n doorbash\r\n"; if (ch.HasInnate(Race.RACE_SHRUG)) text += "&n shrug\r\n"; if (ch.HasInnate(Race.RACE_ODSNEAK)) text += "&n outdoor sneak\r\n"; if (ch.HasInnate(Race.RACE_UDSNEAK)) text += "&n underdark sneak\r\n"; if (ch.HasInnate(Race.RACE_STRENGTH)) text += "&n strength\r\n"; if (ch.HasInnate(Race.RACE_FAERIE_FIRE)) text += "&n faerie fire\r\n"; // if( ch.HasInnate( Race.RACE_STEAL )) // buf += "&n steal\r\n" ); if (ch.HasInnate(Race.RACE_ENLARGE)) text += "&n enlarge\r\n"; if (ch.HasInnate(Race.RACE_INVIS)) text += "&n invisibility\r\n"; // if( ch.HasInnate( Race.RACE_SUMMON_HOARDE )) // buf += "&n summon hoarde\r\n" ); if (ch.HasInnate(Race.RACE_SHIFT_PRIME)) text += "&n shift prime\r\n"; if (ch.HasInnate(Race.RACE_SHIFT_ASTRAL)) text += "&n shift astral\r\n"; if (ch.HasInnate(Race.RACE_LEVITATE)) text += "&n levitate\r\n"; if (ch.HasInnate(Race.RACE_BITE)) text += "&n bite\r\n"; ch.SendText(text); return; }
/// <summary> /// Creates a duplicate of a mobile minus its inventory. /// </summary> /// <param name="parent"></param> /// <param name="clone"></param> public static void CloneMobile( CharData parent, CharData clone ) { int i; if( parent == null || clone == null || !parent.IsNPC() ) return; // Fix values. clone.Name = parent.Name; clone.ShortDescription = parent.ShortDescription; clone.FullDescription = parent.FullDescription; clone.Description = parent.Description; clone.Gender = parent.Gender; clone.CharacterClass = parent.CharacterClass; clone.SetPermRace( parent.GetRace() ); clone.Level = parent.Level; clone.TrustLevel = 0; clone.SpecialFunction = parent.SpecialFunction; clone.SpecialFunctionNames = parent.SpecialFunctionNames; clone.Timer = parent.Timer; clone.Wait = parent.Wait; clone.Hitpoints = parent.Hitpoints; clone.MaxHitpoints = parent.MaxHitpoints; clone.CurrentMana = parent.CurrentMana; clone.MaxMana = parent.MaxMana; clone.CurrentMoves = parent.CurrentMoves; clone.MaxMoves = parent.MaxMoves; clone.SetCoins( parent.GetCopper(), parent.GetSilver(), parent.GetGold(), parent.GetPlatinum() ); clone.ExperiencePoints = parent.ExperiencePoints; clone.ActionFlags = parent.ActionFlags; clone.Affected = parent.Affected; clone.CurrentPosition = parent.CurrentPosition; clone.Alignment = parent.Alignment; clone.Hitroll = parent.Hitroll; clone.Damroll = parent.Damroll; clone.Wimpy = parent.Wimpy; clone.Deaf = parent.Deaf; clone.Hunting = parent.Hunting; clone.Hating = parent.Hating; clone.Fearing = parent.Fearing; clone.Resistant = parent.Resistant; clone.Immune = parent.Immune; clone.Susceptible = parent.Susceptible; clone.CurrentSize = parent.CurrentSize; clone.PermStrength = parent.PermStrength; clone.PermIntelligence = parent.PermIntelligence; clone.PermWisdom = parent.PermWisdom; clone.PermDexterity = parent.PermDexterity; clone.PermConstitution = parent.PermConstitution; clone.PermAgility = parent.PermAgility; clone.PermCharisma = parent.PermCharisma; clone.PermPower = parent.PermPower; clone.PermLuck = parent.PermLuck; clone.ModifiedStrength = parent.ModifiedStrength; clone.ModifiedIntelligence = parent.ModifiedIntelligence; clone.ModifiedWisdom = parent.ModifiedWisdom; clone.ModifiedDexterity = parent.ModifiedDexterity; clone.ModifiedConstitution = parent.ModifiedConstitution; clone.ModifiedAgility = parent.ModifiedAgility; clone.ModifiedCharisma = parent.ModifiedCharisma; clone.ModifiedPower = parent.ModifiedPower; clone.ModifiedLuck = parent.ModifiedLuck; clone.ArmorPoints = parent.ArmorPoints; //clone._mpactnum = parent._mpactnum; for (i = 0; i < 6; i++) { clone.SavingThrows[i] = parent.SavingThrows[i]; } // Now add the affects. foreach (Affect affect in parent.Affected) { clone.AddAffect(affect); } }
public static void ApplyPoison( CharData ch ) { Affect af = new Affect(); bool isSpell = false; foreach (Affect aff in ch.Affected) { if( aff.Type == Affect.AffectType.spell && aff.Value == "poison" ) { isSpell = true; } else if ((aff.Type == Affect.AffectType.skill && aff.Value == "poison weapon" || aff.Value == "poison bite") ) { foreach (AffectApplyType apply in aff.Modifiers) { if (apply.Location != Affect.Apply.none || ch.IsAffected(Affect.AFFECT_SLOW_POISON) && MUDMath.NumberBits(1) == 0) continue; Poison.Type poisonType = (Poison.Type)apply.Amount; int dam; switch (poisonType) { case Poison.Type.damage: SocketConnection.Act("$n&n goes into a brief siezure as the poison courses through $s body.", ch, null, null, SocketConnection.MessageTarget.room); ch.SendText("Your muscles twitch randomly as the poison courses through your body.\r\n"); dam = MUDMath.Dice(1, 10); if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) InflictDamage(ch, ch, dam, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison); else InflictDamage(ch, ch, dam / 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison); return; case Poison.Type.attributes: if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) { int lev = aff.Level; ch.AffectStrip(Affect.AffectType.skill, "poison weapon"); af.Type = Affect.AffectType.skill; af.Value = "poison"; af.Duration = lev / 4; af.Level = lev; af.AddModifier(Affect.Apply.strength, 0 - MUDMath.Dice(1, 20)); af.AddModifier(Affect.Apply.dexterity, 0 - MUDMath.Dice(1, 20)); af.AddModifier(Affect.Apply.agility, 0 - MUDMath.Dice(1, 20)); af.AddModifier(Affect.Apply.constitution, 0 - MUDMath.Dice(1, 20)); af.SetBitvector(Affect.AFFECT_POISON); ch.AddAffect(af); ch.SendText("You suddenly feel quite weak as the poison is distributed through your body.&n\r\n"); SocketConnection.Act("$n&n pales visibly and looks much weaker.", ch, null, null, SocketConnection.MessageTarget.room); return; } ch.SendText("You feel the poison working its way into your system.\r\n"); InflictDamage(ch, ch, 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison); break; case Poison.Type.damage_major: dam = MUDMath.Dice(10, 10); SocketConnection.Act("$n&n screams in agony as the poison courses through $s body.", ch, null, null, SocketConnection.MessageTarget.room); ch.SendText("&+RYour blood is on fire!&n\r\n"); if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) InflictDamage(ch, ch, dam, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison); else InflictDamage(ch, ch, dam / 2, "poison weapon", ObjTemplate.WearLocation.none, AttackType.DamageType.poison); return; case Poison.Type.minor_para: if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) { ch.AffectStrip(Affect.AffectType.skill, "poison_weapon"); af.Value = "poison"; af.Type = Affect.AffectType.skill; af.Duration = MUDMath.NumberRange(1, 10); af.SetBitvector(Affect.AFFECT_MINOR_PARA); ch.AddAffect(af); ch.SendText("&+YYou are paralyzed!&n\r\n"); StopFighting(ch, false); SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n", ch, null, null, SocketConnection.MessageTarget.room); } break; case Poison.Type.minor_para_extended: if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) { ch.AffectStrip(Affect.AffectType.skill, "poison_weapon"); af.Value = "poison"; af.Type = Affect.AffectType.skill; af.Duration = MUDMath.NumberRange(5, 30); af.SetBitvector(Affect.AFFECT_MINOR_PARA); ch.AddAffect(af); ch.SendText("&+YYou are paralyzed!&n\r\n"); StopFighting(ch, false); SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n", ch, null, null, SocketConnection.MessageTarget.room); } break; case Poison.Type.major_para: if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) { ch.AffectStrip(Affect.AffectType.skill, "poison_weapon"); af.Value = "poison"; af.Type = Affect.AffectType.skill; af.Duration = MUDMath.NumberRange(1, 10); af.SetBitvector(Affect.AFFECT_HOLD); ch.AddAffect(af); ch.SendText("&+YYou are paralyzed!&n\r\n"); StopFighting(ch, false); SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n", ch, null, null, SocketConnection.MessageTarget.room); } break; case Poison.Type.major_para_extended: if (!Magic.SpellSavingThrow(aff.Level, ch, AttackType.DamageType.poison)) { ch.AffectStrip(Affect.AffectType.skill, "poison_weapon"); af.Value = "poison"; af.Type = Affect.AffectType.skill; af.Duration = MUDMath.NumberRange(5, 30); af.SetBitvector(Affect.AFFECT_HOLD); ch.AddAffect(af); ch.SendText("&+YYou are paralyzed!&n\r\n"); StopFighting(ch, false); SocketConnection.Act("$n&n&+y is suddenly overcome with rigor and cannot move.&n", ch, null, null, SocketConnection.MessageTarget.room); } break; case Poison.Type.perm_constitution: // TODO: Implement perm constitution loss from poison. break; case Poison.Type.perm_hitpoints: // TODO: Implement perm hitpoint loss from poison. break; case Poison.Type.near_death: // TODO: Implement "near death" poison - one that drains HP very quickly but does not kill. break; default: Log.Error("Unimplemented or unknown poison type: " + poisonType.ToString()); break; } } } //end if } if( isSpell ) { //normal poison from the spell ch.SendText( "You shiver and suffer.\r\n" ); SocketConnection.Act( "$n&n shivers and suffers.", ch, null, null, SocketConnection.MessageTarget.room ); if (!ch.IsAffected(Affect.AFFECT_SLOW_POISON)) { InflictSpellDamage( ch, ch, 2, "poison", AttackType.DamageType.poison ); } else { // Slow poison gives them a 20% chance of avoiding damage // and does half damage when it does hit them, giving // them 40% as much damage overall as a non-slowed person if( MUDMath.NumberPercent() < 80 ) InflictSpellDamage( ch, ch, 1, "poison", AttackType.DamageType.poison ); } } else { //normal poison from a bite or weapon ch.SendText( "You shiver and suffer.\r\n" ); SocketConnection.Act( "$n&n shivers and suffers.", ch, null, null, SocketConnection.MessageTarget.room ); if (!ch.IsAffected(Affect.AFFECT_SLOW_POISON)) { InflictDamage( ch, ch, 2, "poison", ObjTemplate.WearLocation.none, AttackType.DamageType.poison ); } else { // Slow poison gives them a 20% chance of avoiding damage // and does half damage when it does hit them, giving // them 40% as much damage overall as a non-slowed person if( MUDMath.NumberPercent() < 80 ) InflictDamage( ch, ch, 1, "poison", ObjTemplate.WearLocation.none, AttackType.DamageType.poison ); } } }