public bool OnCast(Character caster, string args) { //Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); //if (target == null) { return false; } ReferenceSpell.SendGenericCastMessage(caster, null, true); int damage = 0; if (Skills.GetSkillLevel(caster.magic) >= 4) { damage = Skills.GetSkillLevel(caster.magic) * 16 + GameSpell.GetSpellDamageModifier(caster); } else { damage = 6 * 16 + GameSpell.GetSpellDamageModifier(caster); } ReferenceSpell.CastPathSpell(caster, args, Effect.EffectTypes.Lightning, damage, "lightning", "a bolt", ReferenceSpell.SoundFile); return(true); }
public bool OnCast(Character caster, string args) { // This spell requires arguments. Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null || target.CurrentCell == null) { target = caster; } int dmgMultiplier = 6; // Audrey if (caster is PC) { dmgMultiplier = 8; } int damage = 0; if (Skills.GetSkillLevel(caster.magic) >= 4) { damage = Skills.GetSkillLevel(caster.magic) * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster); } else { damage = 6 * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster); } if (caster is NPC && caster.species == Globals.eSpecies.LightningDrake) { damage = Rules.RollD(Skills.GetSkillLevel(caster.magic), 14); } ReferenceSpell.CastChainSpell(caster, target, Effect.EffectTypes.Lightning, damage, "lightning", "a chain bolt", ReferenceSpell.SoundFile); return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } // Only NPCs are summoned and thus only they are affected by this spell. if ((target is NPC) && (target as NPC).IsSummoned) { ReferenceSpell.SendGenericCastMessage(caster, target, true); if (!Combat.DND_CheckSavingThrow(target, Combat.SavingThrow.Spell, 0)) { target.SendToAllInSight(target.GetNameForActionResult() + " has been banished by " + caster.GetNameForActionResult().Replace("The ", "the ") + "!"); Rules.UnsummonCreature(target as NPC); } else { caster.WriteToDisplay("You fail to banish " + target.GetNameForActionResult(true) + "."); int totalDamage = (Skills.GetSkillLevel(caster.magic) * (caster.IsPC ? GameSpell.BANISH_SPELL_MULTIPLICAND_PC : GameSpell.BANISH_SPELL_MULTIPLICAND_NPC)) + GameSpell.GetSpellDamageModifier(caster); totalDamage += Rules.RollD(1, 2) == 1 ? Rules.RollD(1, 4) : -(Rules.RollD(1, 4)); if (Combat.DoSpellDamage(caster, target, null, totalDamage, ReferenceSpell.Name.ToLower()) == 1) { Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); Rules.GiveKillExp(caster, target); } } } else { caster.WriteToDisplay("Your target cannot be banished."); return(false); } return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } if (target == caster) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); // Cannot drain life from undead or illusions/images. if (target.IsUndead || target.IsImage) { ReferenceSpell.SendGenericUnaffectedMessage(caster, target); return(true); } int damageLevel = caster.Level * 3; if (!caster.IsHybrid) { damageLevel = Skills.GetSkillLevel(caster.magic) + 3; } if (Combat.DoSpellDamage(caster, target, null, Convert.ToInt32(damageLevel * ((caster is PC) ? GameSpell.CURSE_SPELL_MULTIPLICAND_PC : GameSpell.CURSE_SPELL_MULTIPLICAND_NPC)) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name.ToLower()) == 1) { Rules.GiveKillExp(caster, target); if (caster.IsSpellWarmingProfession) { Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } } return(true); }
public bool OnCast(Character caster, string args) { if (caster.CurrentCell != null) { if (caster.CurrentCell.IsWithinTownLimits) { caster.WriteToDisplay("You are standing within town limits."); return(false); } if (caster.CurrentCell.IsMagicDead) { caster.WriteToDisplay("You are standing in an area that is magic dead."); return(false); } } ReferenceSpell.SendGenericCastMessage(caster, null, true); ReferenceSpell.CastGenericAreaSpell(caster, args, Effect.EffectTypes.Thunderwave, (Skills.GetSkillLevel(caster.magic) * 4) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name); return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } if (target == caster) { caster.WriteToDisplay("You cannot cast " + ReferenceSpell.Name + " at yourself."); return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, false); int numOrbs = 1; if (Skills.GetSkillLevel(caster.magic) > 4 && caster.Mana >= ReferenceSpell.ManaCost * 2) { numOrbs++; // 2nd orb at magic skill level 5 } if (Skills.GetSkillLevel(caster.magic) > 9 && caster.Mana >= ReferenceSpell.ManaCost * 3) { numOrbs++; // 3rd orb at magic skill level 10 } if (Skills.GetSkillLevel(caster.magic) > 14 && caster.Mana >= ReferenceSpell.ManaCost * 4) { numOrbs++; // 4th orb at magic skill level 15 } if (Skills.GetSkillLevel(caster.magic) > 18 && caster.Mana >= ReferenceSpell.ManaCost * 5) { numOrbs++; // 5th orb at magic skill level 19 (max as of 12/2/2015 Eb) } // add an orb for magic intensity if (caster.Map.HasRandomMagicIntensity && Rules.RollD(1, 100) >= 50) { numOrbs++; } int attackRoll = 0; while (numOrbs > 0) { caster.EmitSound(ReferenceSpell.SoundFile); int toHit = Combat.DND_RollToHit(caster, target, this, ref attackRoll); // 0 is miss, 1 is hit, 2 is critical int multiplier = 3; Item totem = caster.FindHeldItem(Item.ID_BLOODWOOD_TOTEM); if (totem != null && !totem.IsAttunedToOther(caster)) { multiplier += Rules.RollD(1, 3) + 1; } if (toHit > 0) { target.WriteToDisplay(caster.GetNameForActionResult() + " hits with an " + ReferenceSpell.Name.ToLower() + "!"); if (toHit == 2) { multiplier = 4; caster.WriteToDisplay("Your " + ReferenceSpell.Name + " does critical damage!"); target.WriteToDisplay("The " + ReferenceSpell.Name + " does critical damage!"); } if (Combat.DoSpellDamage(caster, target, null, (Skills.GetSkillLevel(caster.magic) * multiplier) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name) == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Shuriken); return(true); // target is dead, break out of here } else { // magic skill is earned regardless Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); // some shuriken, or throwing item skill is earned as well Skills.GiveSkillExp(caster, target, Globals.eSkillType.Shuriken); } } else { caster.WriteToDisplay("Your " + ReferenceSpell.Name + " misses " + target.GetNameForActionResult(true) + "."); target.WriteToDisplay(caster.GetNameForActionResult() + " misses you with " + Character.POSSESSIVE[(int)caster.gender].ToLower() + " " + ReferenceSpell.Name + "!"); } if (caster.Mana < ReferenceSpell.ManaCost) { return(true); // caster cannot cast any more orbs if no mana left } else if (numOrbs > 1) { caster.Mana -= ReferenceSpell.ManaCost; // reduce mana for each orb past the first (first orb mana is reduced before this method is called) } numOrbs--; } return(true); }
public bool OnCast(Character caster, string args) { int multiplier = 4; Item totem = caster.FindHeldItem(Item.ID_BLOODWOOD_TOTEM); if (totem != null && !totem.IsAttunedToOther(caster)) { multiplier += (Rules.RollD(1, 3) + 1); } ReferenceSpell.SendGenericCastMessage(caster, null, true); ReferenceSpell.CastGenericAreaSpell(caster, args, Effect.EffectTypes.Acid, (Skills.GetSkillLevel(caster.magic) * multiplier) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name); return(true); }
public bool OnCast(Character caster, string args) { if (string.IsNullOrEmpty(args)) { return(false); } Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); // Physically massive entities cannot be hooked. if (Autonomy.EntityBuilding.EntityLists.IsPhysicallyMassive(target)) { caster.WriteToDisplay(target.GetNameForActionResult() + " is too massive to be strangled."); return(false); } // Automatic stun. // Why is the Stunned property/variable still a short? Waste of conversion. 1/12/2017 Eb if (!target.immuneStun && !Autonomy.EntityBuilding.EntityLists.IMMUNE_STUN.Contains(target.entity)) { target.Stunned = (short)Rules.RollD(2, 4); target.WriteToDisplay("You are stunned!"); if (target.preppedSpell != null) { target.preppedSpell = null; target.WriteToDisplay("Your spell has been lost."); target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.SpellFail)); } target.SendToAllInSight(target.GetNameForActionResult() + " is stunned."); } else { caster.WriteToDisplay(target.GetNameForActionResult() + " is immune to being stunned."); } int dmgMultiplier = GameSpell.DEATH_SPELL_MULTIPLICAND_NPC; if (caster.IsPC) { dmgMultiplier = GameSpell.DEATH_SPELL_MULTIPLICAND_PC; // allow players to do slightly more damage than critters at same skill level } ReferenceSpell.SendGenericCastMessage(caster, target, true); if (Combat.DoSpellDamage(caster, target, null, Skills.GetSkillLevel(caster.magic) * 2 * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster), "stranglehold") == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } return(true); }
public bool OnCast(Character caster, string args) { ReferenceSpell.SendGenericCastMessage(caster, null, true); ReferenceSpell.CastGenericAreaSpell(caster, args, Effect.EffectTypes.Light, Skills.GetSkillLevel(caster.magic) * ReferenceSpell.RequiredLevel + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name); return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); int totalDamage = (Skills.GetSkillLevel(caster.magic) * (caster.IsPC ? GameSpell.DEATH_SPELL_MULTIPLICAND_PC : GameSpell.DEATH_SPELL_MULTIPLICAND_NPC)) + GameSpell.GetSpellDamageModifier(caster); totalDamage += Rules.RollD(1, 2) == 1 ? Rules.RollD(1, 4) : -(Rules.RollD(1, 4)); if (Combat.DoSpellDamage(caster, target, null, totalDamage, ReferenceSpell.Name.ToLower()) == 1) { Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); Rules.GiveKillExp(caster, target); } return(true); }
public bool OnCast(Character caster, string args) { try { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); Cell cell = null; if (target == null) { cell = Map.GetCellRelevantToCell(caster.CurrentCell, args, false); } else { cell = target.CurrentCell; } if (cell == null && target == null) { return(false); } #region Path testing. PathTest pathTest = new PathTest(PathTest.RESERVED_NAME_AREAEFFECT + PathTest.RESERVED_NAME_COMMANDSUFFIX, caster.CurrentCell); if (!pathTest.SuccessfulPathTest(cell)) { cell = caster.CurrentCell; } pathTest.RemoveFromWorld(); #endregion cell.SendShout("a thunder clap!"); cell.EmitSound(Sound.GetCommonSound(Sound.CommonSound.ThunderClap)); List <Character> theAffected = new List <Character>(cell.Characters.Values); if (theAffected.Count > 0) { int dmgMultiplier = 6; if (caster is PC) { dmgMultiplier = 8; } int damage = 0; if (Skills.GetSkillLevel(caster.magic) >= 4) { damage = Skills.GetSkillLevel(caster.magic) * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster); } else { damage = 6 * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster); } if (!caster.IsPC) { if (caster.species == Globals.eSpecies.LightningDrake) { damage = Rules.RollD(Skills.GetSkillLevel(caster.magic), 14); } } foreach (Character affected in new List <Character>(theAffected)) { if (Combat.DoSpellDamage(caster, affected, null, damage, "lightning") == 1) { Rules.GiveAEKillExp(caster, affected); Skills.GiveSkillExp(caster, affected, Globals.eSkillType.Magic); } } } } catch (Exception e) { Utils.LogException(e); return(false); } return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } int dmgMultiplier = GameSpell.CURSE_SPELL_MULTIPLICAND_NPC; if (caster.IsPC) { dmgMultiplier = GameSpell.CURSE_SPELL_MULTIPLICAND_PC; // allow players to do slightly more damage than critters at same skill level } ReferenceSpell.SendGenericCastMessage(caster, target, true); if (Combat.DoSpellDamage(caster, target, null, Skills.GetSkillLevel(caster.magic) * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster), "curse") == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); target.WriteToDisplay("You have been hit by a " + ReferenceSpell.Name + "!"); if (Combat.DoSpellDamage(caster, target, null, (Skills.GetSkillLevel(caster.magic) * 12) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name) == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } return(true); }
public bool OnCast(Character caster, string args) { string[] sArgs = args.Split(" ".ToCharArray()); Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, sArgs[sArgs.Length - 1]); if (target == null) { return(false); } if (!target.IsUndead) { caster.WriteToDisplay("The " + ReferenceSpell.Name + " spell only works on the undead."); return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); int totalDamage = (Skills.GetSkillLevel(caster.magic) * ((caster.IsPC ? GameSpell.DEATH_SPELL_MULTIPLICAND_PC : GameSpell.DEATH_SPELL_MULTIPLICAND_NPC) + 1)) + GameSpell.GetSpellDamageModifier(caster); totalDamage += Rules.RollD(1, 2) == 1 ? Rules.RollD(1, 4) : -(Rules.RollD(1, 4)); Item totem = caster.FindHeldItem(Item.ID_BLOODWOOD_TOTEM); if (totem != null && !totem.IsAttunedToOther(caster)) { totalDamage += Rules.RollD(3, 4); } if (Combat.DoSpellDamage(caster, target, null, totalDamage, ReferenceSpell.Name.ToLower()) == 1) { Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); Rules.GiveKillExp(caster, target); } return(true); }
public bool OnCast(Character caster, string args) { if (args == "" || args == null) { return(false); } Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); // Physically massive entities cannot be hooked. if (Autonomy.EntityBuilding.EntityLists.IsPhysicallyMassive(target)) { caster.WriteToDisplay(target.GetNameForActionResult() + " is too massive to be hooked."); return(false); } // Beings who are already stunned cannot be hooked. if (target.Stunned > 1) { caster.WriteToDisplay(target.GetNameForActionResult() + " is already stunned or paralyzed. The Hooks fizzle out of existence."); return(false); } // Amoral beings don't have any concerns about the Ghods. if (target.Alignment == Globals.eAlignment.Amoral) { caster.WriteToDisplay(ReferenceSpell.Name + " does not work on amoral beings."); return(false); } // Target must not be the same alignment as the caster. if (target.Alignment == caster.Alignment) { caster.WriteToDisplay(ReferenceSpell.Name + " will only be successful on beings of an opposing alignment."); return(false); } // Grappling hooks made of divine energy shoot from your hands and latch onto caster.WriteToDisplay("Grappling hooks made of divine energy shoot from your outstretched hands. They latch onto " + target.GetNameForActionResult() + " and pull " + Character.PRONOUN_2[(int)target.gender].ToLower() + " off the ground. " + Character.PRONOUN[(int)target.gender] + " is spun around in the air repeatedly by the hooks and then slammed back to the earth."); caster.SendToAllInSight("Grappling hooks made of divine energy shoot from " + caster.GetNameForActionResult(true) + "'s outstretched hands. They latch onto " + target.GetNameForActionResult(true) + " and pull " + Character.PRONOUN_2[(int)target.gender].ToLower() + " off the ground. " + Character.PRONOUN[(int)target.gender] + " is spun around in the air repeatedly by the hooks and then slammed back to the earth."); // Automatic stun. // Why is the Stunned property/variable still a short? Waste of conversion. 1/12/2017 Eb if (!target.immuneStun && !Autonomy.EntityBuilding.EntityLists.IMMUNE_STUN.Contains(target.entity)) { target.Stunned = (short)Rules.RollD(1, 2); target.WriteToDisplay("You are stunned!"); if (target.preppedSpell != null) { target.preppedSpell = null; target.WriteToDisplay("Your spell has been lost."); target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.SpellFail)); } target.SendToAllInSight(target.GetNameForActionResult() + " is stunned."); } else { caster.WriteToDisplay(target.GetNameForActionResult() + " is immune to being stunned."); } int dmgMultiplier = GameSpell.DEATH_SPELL_MULTIPLICAND_NPC; if (caster.IsPC) { dmgMultiplier = GameSpell.DEATH_SPELL_MULTIPLICAND_PC; // allow players to do slightly more damage than critters at same skill level } target.EmitSound(GameSpell.GetSpell((int)GameSpell.GameSpellID.Curse).SoundFile); if (Combat.DoSpellDamage(caster, target, null, Skills.GetSkillLevel(caster.magic) * dmgMultiplier + GameSpell.GetSpellDamageModifier(caster), "curse") == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } return(true); }
public bool OnCast(Character caster, string args) { if (args == "" || args == null) { caster.WriteToDisplay("You must designate a target."); return(false); } Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); // a result of 1 means the target is killed int numSpears = 1; if (Skills.GetSkillLevel(caster.magic) > 16 && caster.Mana >= ReferenceSpell.ManaCost * 2) { numSpears++; // 2nd missile at magic skill level 17 } if (Skills.GetSkillLevel(caster.magic) > 19 && caster.Mana >= ReferenceSpell.ManaCost * 3) { numSpears++; // 3rd missile at magic skill level 19 RK 1 } while (numSpears > 0) { if (target == null || target.IsDead) { break; } int skillLevel = Skills.GetSkillLevel(caster.magic); if (Combat.DoSpellDamage(caster, target, null, (skillLevel * skillLevel) + GameSpell.GetSpellDamageModifier(caster), "icespear") == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } else { if (Combat.DoSpellDamage(caster, target, null, 0, "stun") == 1) { target.WriteToDisplay("You are stunned!"); if (target.preppedSpell != null) { target.preppedSpell = null; target.WriteToDisplay("Your spell has been lost."); target.EmitSound(Sound.GetCommonSound(Sound.CommonSound.SpellFail)); } target.Stunned = (short)(Rules.Dice.Next(1, Skills.GetSkillLevel(caster.magic) / 3) + 1); target.SendToAllInSight(target.GetNameForActionResult() + " is stunned by an " + ReferenceSpell.Name + "!"); } else { caster.WriteToDisplay(target.GetNameForActionResult() + " resists being stunned by your " + ReferenceSpell.Name + "!"); target.WriteToDisplay("You resist being stunned by the " + ReferenceSpell.Name + "!"); } } numSpears--; } return(true); }
public bool OnCast(Character caster, string args) { Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args); if (target == null) { return(false); } ReferenceSpell.SendGenericCastMessage(caster, target, true); int numMissiles = 1; if (Skills.GetSkillLevel(caster.magic) > 5 && caster.Mana >= ReferenceSpell.ManaCost * 2) { numMissiles++; // 2nd missile at magic skill level 6 } if (Skills.GetSkillLevel(caster.magic) > 10 && caster.Mana >= ReferenceSpell.ManaCost * 3) { numMissiles++; // 3rd missile at magic skill level 11 } if (Skills.GetSkillLevel(caster.magic) > 15 && caster.Mana >= ReferenceSpell.ManaCost * 4) { numMissiles++; // 3rd missile at magic skill level 16 } if (Skills.GetSkillLevel(caster.magic) > 20 && caster.Mana >= ReferenceSpell.ManaCost * 5) { numMissiles++; // 3rd missile at magic skill level 21 } while (numMissiles > 0) { if (target == null || target.IsDead) { break; } if (Combat.DoSpellDamage(caster, target, null, (Skills.GetSkillLevel(caster.magic) * 3) + GameSpell.GetSpellDamageModifier(caster), ReferenceSpell.Name) == 1) { Rules.GiveKillExp(caster, target); Skills.GiveSkillExp(caster, target, Globals.eSkillType.Magic); } if (caster.Mana < ReferenceSpell.ManaCost) { return(true); // caster cannot cast any more orbs if no mana left } else if (numMissiles > 1) { caster.Mana -= ReferenceSpell.ManaCost; // reduce mana for each orb past the first (first orb mana is reduced before this method is called) } numMissiles--; } return(true); }