public static SpellReticule Create(GameObject reticule, Vector3 pos, Quaternion rot, ISpell spell, SpellRegistry registry, Parent parent) { GameObject newObject = Instantiate(reticule, pos, rot) as GameObject; SpellReticule ret = newObject.GetComponent<SpellReticule>(); ret._spell = spell; ret._registry = registry; ret._registryId = registry.Register(ret); ret._parent = parent; return ret; }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } var spell = SpellRegistry.Create(SpellEntry, from, this); if (spell != null) { spell.Cast(); } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } }
private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e) { Mobile from = e.Mobile; if (!Multis.DesignContext.Check(from)) { return; // They are customizing } Spellbook book = e.Spellbook as Spellbook; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } if (book != null && book.HasSpell(spellID)) { SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { spell.Cast(); } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } } else { from.SendLocalizedMessage(500015); // You do not have that spell! } }
public virtual SpecialMove GetSpecialMove() { var skill = (int)m_Mobile.Skills[SkillName.Bushido].Value; if (skill <= 50) { return(null); } if (m_Mobile.Combatant != null && m_Mobile.Combatant.Hits <= 10 && skill >= 25) { return(SpellRegistry.GetSpecialMove(400)); //new HonerableExecution(); } if (skill >= 70 && CheckForMomentumStrike() && 0.5 > Utility.RandomDouble()) { return(SpellRegistry.GetSpecialMove(405)); //new MomentumStrike(); } return(SpellRegistry.GetSpecialMove(404)); // new LightningStrike(); }
public static void Cast_OnCommand(CommandEventArgs e) { if (e.Length == 1) { Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null); if (spell != null) { spell.Cast(); } else { e.Mobile.SendMessage("That spell was not found."); } } else { e.Mobile.SendMessage("Format: Cast <name>"); } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from is PlayerMobile) { PlayerMobile m = (PlayerMobile)from; if (info.ButtonID >= 1 && info.ButtonID < 1000) { Spell spell = SpellRegistry.NewSpell(info.ButtonID, m, null); if (spell != null) { spell.Cast(); } m.SendGump(new NewSpellbookGump(m, m_Book)); } else if (info.ButtonID >= 1000 && info.ButtonID < 2000) { if (m.QuickSpells == null) { return; } if (m.QuickSpells.Contains((int)(info.ButtonID - 1000))) { m.SendMessage("Le sort a été retiré de votre liste de lancement rapide."); m.QuickSpells.Remove((int)(info.ButtonID - 1000)); } else { m.SendMessage("Le sort a été ajouté à votre liste de lancement rapide."); m.QuickSpells.Add((int)(info.ButtonID - 1000)); } m.SendGump(new NewSpellbookGump(m, m_Book)); } } }
public static void Initialize() { Spell s; SpellInfo o; Type t; for (int i = 0, j = 8320; i < SpellRegistry.Types.Length; i++, j++) { s = SpellRegistry.NewSpell(i, null, null); if (s == null) { continue; } o = s.Info; if (o == null) { continue; } t = SpellRegistry.Types[i] ?? s.GetType(); SpellsInfo[t] = new SpellInfo( o.Name, o.Mantra, o.Action, o.LeftHandEffect, o.RightHandEffect, o.AllowTown, o.Reagents); if (SpellIcons.IsItemIcon(j)) { ItemSpellIcons[t] = j; } } InvalidateTreeStructure(); }
private void UseAttackAbility() { ArrayList t = BaseAttackHelperSE.GetAllAttackers(m_Mobile, 2); if (t.Count > 1) { if (Utility.Random(3) != 1) { if (CanUseAbility(70.0, 10, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(405)); // Momentum Strike return; } } } if (CanUseAbility(50.0, 5, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(404)); // Lightning Strike } return; }
private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e) { Mobile from = e.Mobile; if (!DesignContext.Check(from)) { return; // They are customizing } var book = e.Spellbook as Spellbook; int spellID = e.SpellID; if (book == null || !book.HasSpell(spellID)) { book = Find(from, spellID); } // add check for pseudoseer controlled mob var bc = from as BaseCreature; if ((from is PlayerMobile || bc == null || bc.Deleted || bc.NetState == null || bc.Pseu_SpellBookRequired) && (book == null || !book.HasSpell(spellID))) { from.SendLocalizedMessage(500015); // You do not have that spell! return; } Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { spell.Cast(); } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } }
public override void OnDoubleClick(Mobile from) { if (!Multis.DesignContext.Check(from)) { return; // They are customizing } if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } Spell spell = SpellRegistry.NewSpell(m_SpellID, from, this); if (spell != null) { spell.Cast(); } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } }
public static void Sort_OnCommand(CommandEventArgs e) { if (e.Length == 1) { if (Book[e.Mobile] == null) { e.Mobile.SendMessage("Veuillez choisir le livre de sort en faisant .qsl"); return; } Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null); if (spell == null) { e.Mobile.SendMessage("Le nom du sort n'existe pas"); return; } } else { e.Mobile.SendMessage("Format: Sort <Nom>"); } }
private static void Targeted_Spell(TargetedSpellEventArgs e) { Mobile from = e.NetState.Mobile; if (!Multis.DesignContext.Check(from)) { return; // They are customizing } int spellID = e.SpellID; SpecialMove move = SpellRegistry.GetSpecialMove(spellID); if (move != null) { SpecialMove.SetCurrentMove(from, move); } else { Spell spell = SpellRegistry.NewSpell(spellID, from, null); if (spell != null) { try { from.TargetLocked = true; Mobile targeted = World.FindMobile(e.Target.Serial); spell.DefineTargetForeignSpell(targeted); spell.Cast(); } catch { Console.WriteLine("Erro target Spell."); } finally { from.TargetLocked = false; } } else { from.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } } }
public static void Cast_OnCommand(CommandEventArgs e) { if (e.Length == 1) { if (!Multis.DesignContext.Check(e.Mobile)) { return; // They are customizing } Spell spell = SpellRegistry.NewSpell(e.GetString(0), e.Mobile, null); if (spell != null) { spell.Cast(); } else { e.Mobile.SendMessage("That spell was not found."); } } else { e.Mobile.SendMessage("Format: Cast <name>"); } }
public virtual void OnCastSuccessful(Mobile caster) { if (Evasion.IsEvading(caster)) { Evasion.EndEvasion(caster); } if (Confidence.IsConfident(caster)) { Confidence.EndConfidence(caster); } if (CounterAttack.IsCountering(caster)) { CounterAttack.StopCountering(caster); } int spellID = SpellRegistry.GetRegistryNumber(this); if (spellID > 0) { caster.Send(new ToggleSpecialAbility(spellID + 1, true)); } }
public override void OnThink() { base.OnThink(); if (Combatant == null) { return; } if (_NextMastery < DateTime.UtcNow) { if (SkillMasterySpell.HasSpell(this, typeof(RampageSpell)) || Utility.RandomDouble() > 0.5) { SpecialMove.SetCurrentMove(this, SpellRegistry.GetSpecialMove(740)); } else { SkillMasterySpell spell = new RampageSpell(this, null); spell.Cast(); } _NextMastery = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 70)); } }
public static void Initialize() { CommandSystem.Register("F**k", AccessLevel.Player, e => { //Console.WriteLine("[+] " + e.ArgString); if (!int.TryParse(e.ArgString, out int spellID)) { e.Mobile.SendMessage("[-] wrong magic spell id."); return; } Spell spell = SpellRegistry.NewSpell(spellID, e.Mobile, null); if (spell != null) { if (!spell.Cast()) { e.Mobile.SendMessage("[-] 启动法术{0}失败.", spell.Name); return; } } }); }
// Use this for initialization void Start() { _registry = FindObjectsOfType(typeof(SpellRegistry)).Cast <SpellRegistry>().First(); }
public void RunicCastingBagCast(Mobile m, RunicCastingBag bag) { // descs from U6. For reference. // I've left in my notes for rareness, this is custom to my shard. bool foundAn = false; // Negate/Dispel - common bool foundBal = false; bool foundBet = false; // Small - semi-common bool foundChar = false; bool foundCorp = false; // Death - rare bool foundDes = false; // Lower/Down - semi-common bool foundEx = false; // Freedom - semi-common bool foundFlam = false; // Flame - semi-common bool foundGrav = false; // Energy/Field - rare bool foundHur = false; // Wind - semi-common bool foundIn = false; // Make/Create/Cause - common bool foundJux = false; // Danger/Trap/Harm - semi-common bool foundKal = false; // Summon/Invoke - common bool foundLor = false; // Light - common bool foundMani = false; // Life/Healing - common bool foundNox = false; // Poison - semi-common bool foundAgle = false; bool foundOrt = false; // Magic - semi-common bool foundPas = false; bool foundPor = false; // Move/Movement - semi-common bool foundQuas = false; // Illusion - semi-common bool foundRel = false; // Change - common bool foundSanct = false; // Protect/Protection - semi-common bool foundSar = false; bool foundTym = false; // Time - rare bool foundUm = false; bool foundUus = false; // Raise/Up - semi-common bool foundVas = false; // Great - rare bool foundWis = false; // Know/Knowledge - semi-common bool foundXen = false; // Creature - semi-common bool foundYlem = false; // Matter - semi-common bool foundZu = false; // Sleep - semi-common foreach (Item I in bag.Items) { if (I is An) { foundAn = true; } if (I is Bal) { foundBal = true; } if (I is Bet) { foundBet = true; } if (I is CharRune) { foundChar = true; } if (I is Corp) { foundCorp = true; } if (I is Des) { foundDes = true; } if (I is Ex) { foundEx = true; } if (I is Flam) { foundFlam = true; } if (I is Grav) { foundGrav = true; } if (I is Hur) { foundHur = true; } if (I is In) { foundIn = true; } if (I is Jux) { foundJux = true; } if (I is Kal) { foundKal = true; } if (I is Lor) { foundLor = true; } if (I is Mani) { foundMani = true; } if (I is Nox) { foundNox = true; } if (I is Agle) { foundAgle = true; } if (I is Ort) { foundOrt = true; } if (I is Pas) { foundPas = true; } if (I is Por) { foundPor = true; } if (I is Quas) { foundQuas = true; } if (I is Rel) { foundRel = true; } if (I is Sanct) { foundSanct = true; } if (I is Sar) { foundSar = true; } if (I is Tym) { foundTym = true; } if (I is Um) { foundUm = true; } if (I is Uus) { foundUus = true; } if (I is Vas) { foundVas = true; } if (I is Wis) { foundWis = true; } if (I is Xen) { foundXen = true; } if (I is Ylem) { foundYlem = true; } if (I is Zu) { foundZu = true; } } int m_SpellID = -1; // no match /// spells go here. //////////////////////////////////////////// //if ( ( found ) ) && bag.Items.Count == ) // m_SpellID = ; /// first circle ///////////////////////////////////////////// // clumsy: Uus Jux if ((foundUus && foundJux) && bag.Items.Count == 2) { m_SpellID = 0; } // Create food: In Mani Ylem if ((foundIn && foundMani && foundYlem) && bag.Items.Count == 3) { m_SpellID = 1; } // Feeblemind: Rel Wis if ((foundRel && foundWis) && bag.Items.Count == 2) { m_SpellID = 2; } // Heal: In Mani if ((foundIn && foundMani) && bag.Items.Count == 2) { m_SpellID = 3; } // Magic arrow: In Por Ylem if ((foundIn && foundPor && foundYlem) && bag.Items.Count == 3) { m_SpellID = 4; } // Night sight: In Lor if ((foundIn && foundLor) && bag.Items.Count == 2) { m_SpellID = 5; } // Reactive armor: Flam Sanct if ((foundFlam && foundSanct) && bag.Items.Count == 2) { m_SpellID = 6; } // Weaken: Des Mani if ((foundDes && foundMani) && bag.Items.Count == 2) { m_SpellID = 7; } /// second circle /////////////////////////////////////////////// // Agility: Ex Uus if ((foundUus && foundEx) && bag.Items.Count == 2) { m_SpellID = 8; } // Cunning: Uus Wis if ((foundUus && foundWis) && bag.Items.Count == 2) { m_SpellID = 9; } // Cure: An Nox if ((foundAn && foundNox) && bag.Items.Count == 2) { m_SpellID = 10; } // Harm: An Mani if ((foundAn && foundMani) && bag.Items.Count == 2) { m_SpellID = 11; } // Magic Trap: In Jux if ((foundIn && foundJux) && bag.Items.Count == 2) { m_SpellID = 12; } // Magic Untrap: An Jux if ((foundAn && foundJux) && bag.Items.Count == 2) { m_SpellID = 13; } // Protection: Uus Sanct if ((foundUus && foundSanct) && bag.Items.Count == 2) { m_SpellID = 14; } // Strength: Uus Mani if ((foundUus && foundMani) && bag.Items.Count == 2) { m_SpellID = 15; } /// Third circle //////////////////////////////////////////// // Bless: Rel Sanct if ((foundRel && foundSanct) && bag.Items.Count == 2) { m_SpellID = 16; } // Fireball: Vas Flam if ((foundVas && foundFlam) && bag.Items.Count == 2) { m_SpellID = 17; } // Magic Lock: An Por if ((foundAn && foundPor) && bag.Items.Count == 2) { m_SpellID = 18; } // Poison: In Nox if ((foundIn && foundNox) && bag.Items.Count == 2) { m_SpellID = 19; } // Telekinesis: Ort Por Ylem if ((foundOrt && foundPor && foundYlem) && bag.Items.Count == 3) { m_SpellID = 20; } // Teleport: Rel Por if ((foundRel && foundPor) && bag.Items.Count == 2) { m_SpellID = 21; } // Unlock: Ex Por if ((foundEx && foundPor) && bag.Items.Count == 2) { m_SpellID = 22; } // Wall of Stone: In Sanct Ylem if ((foundIn && foundSanct && foundYlem) && bag.Items.Count == 3) { m_SpellID = 23; } /// Fourth circle //////////////////////////////////////////// // Arch Cure: Vas An Nox if ((foundVas && foundAn && foundNox) && bag.Items.Count == 3) { m_SpellID = 24; } // Arch Protection: Vas Uus Sanct if ((foundVas && foundUus && foundSanct) && bag.Items.Count == 3) { m_SpellID = 25; } // Curse: Des Sanct if ((foundDes && foundSanct) && bag.Items.Count == 2) { m_SpellID = 26; } // Fire Field: In Flam Grav if ((foundIn && foundFlam && foundGrav) && bag.Items.Count == 3) { m_SpellID = 27; } // Greater Heal: In Vas Mani if ((foundIn && foundVas && foundMani) && bag.Items.Count == 3) { m_SpellID = 28; } // Lightning: Por Ort Grav if ((foundPor && foundOrt && foundGrav) && bag.Items.Count == 3) { m_SpellID = 29; } // Mana Drain: Ort Rel if ((foundOrt && foundRel) && bag.Items.Count == 2) { m_SpellID = 30; } // Recall: Kal Ort Por if ((foundKal && foundOrt && foundPor) && bag.Items.Count == 3) { m_SpellID = 31; } /// Fifth circle //////////////////////////////////////////// // Blade Spirits: In Jux Hur Ylem if ((foundIn && foundJux && foundHur && foundYlem) && bag.Items.Count == 4) { m_SpellID = 32; } // Dispel Field: An Grav if ((foundAn && foundGrav) && bag.Items.Count == 2) { m_SpellID = 33; } // Incognito: Kal In Ex if ((foundKal && foundIn && foundEx) && bag.Items.Count == 3) { m_SpellID = 34; } // Magic Reflection: In Jux Sanct if ((foundIn && foundJux && foundSanct) && bag.Items.Count == 3) { m_SpellID = 35; } // Mind Blast: Por Corp Wis if ((foundPor && foundCorp && foundWis) && bag.Items.Count == 3) { m_SpellID = 36; } // Paralyze: An Ex Por if ((foundAn && foundEx && foundPor) && bag.Items.Count == 3) { m_SpellID = 37; } // PoisonField: In Nox Grav if ((foundIn && foundNox && foundGrav) && bag.Items.Count == 3) { m_SpellID = 38; } // Summon Creature: Kal Xen if ((foundKal && foundXen) && bag.Items.Count == 2) { m_SpellID = 39; } /// Sixth circle //////////////////////////////////////////// // Dispel: An Ort if ((foundAn && foundOrt) && bag.Items.Count == 2) { m_SpellID = 40; } // Eenrgy Bolt: Corp Por if ((foundCorp && foundPor) && bag.Items.Count == 2) { m_SpellID = 41; } // Explosion: Vas Ort Flam if ((foundVas && foundOrt && foundFlam) && bag.Items.Count == 3) { m_SpellID = 42; } // Invisibility: An Lor Xen if ((foundAn && foundLor && foundXen) && bag.Items.Count == 3) { m_SpellID = 43; } // Mark: Kal Por Ylem if ((foundKal && foundPor && foundYlem) && bag.Items.Count == 3) { m_SpellID = 44; } // Mass Curse: Vas Des Sanct if ((foundVas && foundDes && foundSanct) && bag.Items.Count == 3) { m_SpellID = 45; } // Paralyze Field: In Ex Grav if ((foundIn && foundEx && foundGrav) && bag.Items.Count == 3) { m_SpellID = 46; } // Reveal: Wis Quas if ((foundWis && foundQuas) && bag.Items.Count == 2) { m_SpellID = 47; } /// Seventh circle //////////////////////////////////////////// // Chain Lightning: Vas Ort Grav if ((foundVas && foundOrt && foundGrav) && bag.Items.Count == 3) { m_SpellID = 48; } // Energy Field: In Sanct Grav if ((foundIn && foundSanct && foundGrav) && bag.Items.Count == 3) { m_SpellID = 49; } // Flame Strike: Kal Vas Flam if ((foundKal && foundVas && foundFlam) && bag.Items.Count == 3) { m_SpellID = 50; } // Gate Travel: Vas Rel Por if ((foundVas && foundRel && foundPor) && bag.Items.Count == 3) { m_SpellID = 51; } // Mana Vampire: Ort Sanct if ((foundOrt && foundSanct) && bag.Items.Count == 2) { m_SpellID = 52; } // Mass Dispel: Vas An Ort if ((foundVas && foundAn && foundOrt) && bag.Items.Count == 3) { m_SpellID = 53; } // Meteor Swarm: Flam Kal Des Ylem if ((foundFlam && foundKal && foundDes && foundYlem) && bag.Items.Count == 4) { m_SpellID = 54; } // Polymorph: Vas Ylem Rel if ((foundVas && foundYlem && foundRel) && bag.Items.Count == 3) { m_SpellID = 55; } // Captain the First was the First one to code the 8th circle spells and publish them! /// Eighth circle //////////////////////////////////////////// // "Earthquake", "In Vas Por" if ((foundIn && foundVas && foundPor) && bag.Items.Count == 3) { m_SpellID = 56; } // "Energy Vortex", "Vas Corp Por" if ((foundVas && foundCorp && foundPor) && bag.Items.Count == 3) { m_SpellID = 57; } // "Resurrection", "An Corp" if ((foundAn && foundCorp) && bag.Items.Count == 2) { m_SpellID = 58; } // "Air Elemental", "Kal Vas Xen Hur" if ((foundKal && foundVas && foundXen && foundHur) && bag.Items.Count == 4) { m_SpellID = 59; } // "Summon Daemon", "Kal Vas Xen Corp" if ((foundKal && foundVas && foundXen && foundCorp) && bag.Items.Count == 4) { m_SpellID = 60; } // "Earth Elemental", "Kal Vas Xen Ylem" if ((foundKal && foundVas && foundXen && foundYlem) && bag.Items.Count == 4) { m_SpellID = 61; } // "Fire Elemental", "Kal Vas Xen Flam" if ((foundKal && foundVas && foundXen && foundFlam) && bag.Items.Count == 4) { m_SpellID = 62; } // "Water Elemental", "Kal Vas Xen An Flam" if ((foundKal && foundVas && foundXen && foundAn && foundFlam) && bag.Items.Count == 5) { m_SpellID = 63; } // Necromancy Spells /////////////////////////////// // Animate Dead, "Uus Corp" if ((foundUus && foundCorp) && bag.Items.Count == 2) { m_SpellID = 100; } // Blood Oath, "In Jux Mani Xen" if ((foundIn && foundJux && foundMani && foundXen) && bag.Items.Count == 4) { m_SpellID = 101; } // Corpse Skin, "In Agle Corp Ylem" if ((foundIn && foundAgle && foundCorp && foundYlem) && bag.Items.Count == 4) { m_SpellID = 102; } // Curse Weapon, "An Sanct Grav Char" if ((foundAn && foundSanct && foundGrav && foundChar) && bag.Items.Count == 4) { m_SpellID = 103; } // Evil Omen, "Pas Tym An Sanct" if ((foundPas && foundTym && foundAn && foundSanct) && bag.Items.Count == 4) { m_SpellID = 104; } // Exorcism, "Ort Corp Grav" if ((foundOrt && foundCorp && foundGrav) && bag.Items.Count == 3) { m_SpellID = 116; } // Horrific Beast, "Rel Xen Vas Bal" if ((foundRel && foundXen && foundVas && foundBal) && bag.Items.Count == 4) { m_SpellID = 105; } // Lich Form, "Rel Xen Corp Ort" if ((foundRel && foundXen && foundCorp && foundOrt) && bag.Items.Count == 4) { m_SpellID = 106; } // Mind Rot, "Wis An Bet" if ((foundWis && foundAn && foundBet) && bag.Items.Count == 3) { m_SpellID = 107; } // Pain Spike, "In Sar" if ((foundIn && foundSar) && bag.Items.Count == 2) { m_SpellID = 108; } // Poison Spike, "In Vas Nox" if ((foundIn && foundVas && foundNox) && bag.Items.Count == 3) { m_SpellID = 109; } // Strangle, "In Bal Nox" if ((foundIn && foundBal && foundNox) && bag.Items.Count == 3) { m_SpellID = 110; } // Summon Familiar, "Kal Xen Bal" if ((foundKal && foundXen && foundBal) && bag.Items.Count == 3) { m_SpellID = 111; } // Vampiric Embrace, "Rel Xen An Sanct" if ((foundRel && foundXen && foundAn && foundSanct) && bag.Items.Count == 4) { m_SpellID = 112; } // Vengeful Spirit, "Kal Xen Bal Bet" if ((foundKal && foundXen && foundBal && foundBet) && bag.Items.Count == 4) { m_SpellID = 113; } // Wither, "Kal Vas An Flam" if ((foundKal && foundVas && foundAn && foundFlam) && bag.Items.Count == 4) { m_SpellID = 114; } // Wraith Form, "Rel Xen Um" if ((foundRel && foundXen && foundUm) && bag.Items.Count == 3) { m_SpellID = 115; } /// end spells ///////////////////////////////////// if (foundZu) // currently unused. { m.SendLocalizedMessage(1008128); // *shudders from extreme cold!* } //m.SendMessage("One of the runestones feels cold."); /// end spells ///////////////////////////////////// /// begin spellcasting ///////////////////////////// if (!Multis.DesignContext.Check(m)) { return; // They are customizing } if (!IsChildOf(m.Backpack)) { m.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. return; } if (m_SpellID == -1) { //1042648 Error: Invalid Special Effect Number //500202 Spell failed //500208 It appears to be blank. //501631 You have failed to create the rune book. //501999 hrmph, I failed. //1010548 I failed at isGoodObject. //1042148 Creation failed. Please try again. //1044043 You failed to create the item, and some of your materials are lost. //3000027 Bind Failed //1044043 You failed to create the item, and some of your materials are lost. //1044157 You fail to create the item, but no materials were lost. m.SendLocalizedMessage(1044043); // You failed to create the item, and some of your materials are lost. //m.SendMessage("Not a valid spell"); return; } Spell spell = SpellRegistry.NewSpell(m_SpellID, m, this); if (spell != null) { spell.Cast(); //If you would want to drop 50% of the time, you would write: //if ( 0.5 > Utility.RandomDouble() ) if (0.25 > Utility.RandomDouble()) { //this should delete the runes after casting, if you want to do that. //code snippet 'borrowed' from baseboard =D //1010474 The etching on the rune has been changed. //1046115 I have the rune right here. No? Maybe in this pocket? No. Well - this is most embarrassing. //1072896 runed switch //1049060 That item is too broken to increase its durability. //1038290 It looks to have suffered some wear and tear. m.SendLocalizedMessage(1008114); //You have lost some resources for (int i = bag.Items.Count - 1; i >= 0; --i) { if (i < bag.Items.Count) { ((Item)Items[i]).Delete(); } } } } else { m.SendLocalizedMessage(502345); // This spell has been temporarily disabled. } }
public virtual SpecialMove GetHiddenSpecialMove() { int skill = (int)m_Mobile.Skills[SkillName.Ninjitsu].Value; if (skill < 40) { return(null); } if (skill >= 60) { //return .5 > Utility.RandomDouble() ? new SupriseAttack() : new Backstab(); return(.5 > Utility.RandomDouble() ? SpellRegistry.GetSpecialMove(504) : SpellRegistry.GetSpecialMove(505)); } return(SpellRegistry.GetSpecialMove(505)); //new Backstab(); }
public static SpellReticule Create(GameObject reticule, Vector3 pos, Quaternion rot, ISpell spell, SpellRegistry registry, Parent parent) { GameObject newObject = Instantiate(reticule, pos, rot) as GameObject; SpellReticule ret = newObject.GetComponent <SpellReticule>(); ret._spell = spell; ret._registry = registry; ret._registryId = registry.Register(ret); ret._parent = parent; return(ret); }
protected override void CompileOptions(ToolbarGump toolbar, GumpButton clicked, Point loc, MenuGumpOptions opts) { if (toolbar == null) { return; } base.CompileOptions(toolbar, clicked, loc, opts); var user = toolbar.State.User; if (CanEdit || user.AccessLevel >= Toolbars.Access) { opts.Replace( "Set Value", new ListGumpEntry( "Set Spell", b => { toolbar.Refresh(true); MenuGump menu1 = null; var menuOpts1 = new MenuGumpOptions(); foreach (var kvp1 in SpellUtility.TreeStructure) { var circle = kvp1.Key; var types = kvp1.Value; menuOpts1.AppendEntry( new ListGumpEntry( circle, b2 => { var menuOpts2 = new MenuGumpOptions(); foreach (var kvp2 in types) { var id = SpellRegistry.GetRegistryNumber(kvp2.Key); var si = kvp2.Value; var book = Spellbook.Find(user, id); if (book != null && book.HasSpell(id)) { menuOpts2.AppendEntry( new ListGumpEntry( si.Name, menu2Button => { SpellID = id; Value = si.Name; Label = String.Empty; toolbar.Refresh(true); }, (SpellID == id) ? toolbar.HighlightHue : toolbar.TextHue)); } } if (menu1 != null) { SuperGump.Send(new MenuGump(user, clicked.Parent, menuOpts2, clicked)); } })); } menu1 = new MenuGump(user, clicked.Parent, menuOpts1, clicked); SuperGump.Send(menu1); }, toolbar.HighlightHue)); } }
// Use this for initialization void Start() { _registry = FindObjectsOfType(typeof(SpellRegistry)).Cast<SpellRegistry>().First(); }
public override object GetMasterySpell() { if (TribeType != EodonTribe.Urali) { BaseWeapon wep = Weapon as BaseWeapon; if (wep == null) { return(null); } switch (wep.DefSkill) { case SkillName.Swords: if (.5 > Utility.RandomDouble()) { return(new FocusedEyeSpell(this, null)); } else { return(SpellRegistry.GetSpecialMove(728)); } case SkillName.Fencing: if (.5 > Utility.RandomDouble()) { return(new ThrustSpell(this, null)); } else { return(SpellRegistry.GetSpecialMove(725)); } case SkillName.Macing: if (.5 > Utility.RandomDouble()) { return(new ToughnessSpell(this, null)); } else { return(SpellRegistry.GetSpecialMove(726)); } case SkillName.Wrestling: if (.5 > Utility.RandomDouble()) { return(new RampageSpell(this, null)); } else { return(SpellRegistry.GetSpecialMove(740)); } case SkillName.Archery: if (.5 > Utility.RandomDouble()) { return(new FlamingShotSpell(this, null)); } else { return(new PlayingTheOddsSpell(this, null)); } case SkillName.Throwing: if (.5 > Utility.RandomDouble()) { return(new ElementalFurySpell(this, null)); } else { return(new CalledShotSpell(this, null)); } } } return(null); }
public override bool DoActionCombat() { if (m_Mobile.BodyMod != 0) { ChangeForm(0); } Mobile combatant = m_Mobile.Combatant; if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { m_Mobile.DebugSay("My combatant is gone, so my guard is up"); Action = ActionType.Guard; return(true); } /*if ( !m_Mobile.InLOS( combatant ) ) * { * if ( AcquireFocusMob( m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true ) ) * { * m_Mobile.Combatant = combatant = m_Mobile.FocusMob; * m_Mobile.FocusMob = null; * } * }*/ if (MoveTo(combatant, true, m_Mobile.RangeFight)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant); } else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) { m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; return(true); } else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name); } Action = ActionType.Guard; return(true); } else { if (m_Mobile.Debug) { m_Mobile.DebugSay("I should be closer to {0}", combatant.Name); } } if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee) { if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < combatant.Hits) { // We are more hurt than them int diff = combatant.Hits - m_Mobile.Hits; flee = (Utility.Random(0, 100) < (10 + diff)); // (10 + diff)% chance to flee } else { flee = Utility.Random(0, 100) < 10; // 10% chance to flee } if (flee) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name); } Action = ActionType.Flee; if (CanUseAbility(50.0, 15, shadowJumpChance)) { PerformHide(); m_Mobile.UseSkill(SkillName.Stealth); if (m_Mobile.AllowedStealthSteps != 0) { if (PerformShadowjump(combatant)) { m_Mobile.Mana -= 15; } } } } } } if (combatant.Hits < (Utility.Random(10) + 10)) { if (CanUseAbility(85.0, 30, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(501)); // Death Strike return(true); } } double dstToTarget = m_Mobile.GetDistanceToSqrt(combatant); if (dstToTarget > 2.0 && dstToTarget <= (m_Mobile.Skills[SkillName.Ninjitsu].Value / 10.0) && m_Mobile.Mana > 45 && comboChance > (Utility.RandomDouble() + MagnitudeBySkill())) { PerformHide(); m_Mobile.UseSkill(SkillName.Stealth); if (m_Mobile.AllowedStealthSteps != 0) { if (CanUseAbility(20.0, 30, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(505)); // Backstab } if (CanUseAbility(30.0, 20, 1.0)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(504)); // Surprise Attack } PerformFocusAttack(); if (PerformShadowjump(combatant)) { m_Mobile.Mana -= 15; } } return(true); } if (PerformMirror()) { return(true); } if (CanUseAbility(80.0, 25, kiChance) && m_Mobile.GetDistanceToSqrt(combatant) < 2.0) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(503)); // Ki Attack return(true); } PerformFocusAttack(); return(true); }
public virtual SpecialMove GetHiddenSpecialMove() { double skill = m_Mobile.Skills[SkillName.Ninjitsu].Value; SpecialMove special = SpecialMove.GetCurrentMove(m_Mobile); if (special != null) { return(special); } if (skill < 20 || m_Mobile.Mana < 30) { return(null); } int avail = 1; if (m_Mobile.AllowedStealthSteps != 0) { if (skill >= 30) { avail = 2; } Mobile combatant = m_Mobile.Combatant; if (skill >= 85) { avail = 3; //Mobile combatant = m_Mobile.Combatant; if (combatant != null && (combatant.Hits < (Utility.Random(10) + 10) || !combatant.Warmode)) { return(SpellRegistry.GetSpecialMove(501)); } } switch (Utility.Random(avail)) { case 0: combatant.Say("Getting BackStab"); return(SpellRegistry.GetSpecialMove(505)); //new Backstab(); skill = 20; case 1: combatant.Say("Getting SurpriseAttack"); return(SpellRegistry.GetSpecialMove(504)); //new SurpriseAttack(); skill = 30; case 2: combatant.Say("Getting DeathStrike"); return(SpellRegistry.GetSpecialMove(501)); //new DeathStrike(); skill = 85; } } else { if (skill < 30) { return(null); } if (skill < 80) { avail = 2; } if (skill >= 85) { avail = 3; Mobile combatant = m_Mobile.Combatant; if (combatant != null && (int)combatant.Hits < (Utility.Random(10) + 10)) { return(SpellRegistry.GetSpecialMove(501)); } } switch (Utility.Random(avail)) { case 0: return(SpellRegistry.GetSpecialMove(500)); //new FocusAttack(); case 1: return(SpellRegistry.GetSpecialMove(503)); //new KiAttack(); case 2: return(SpellRegistry.GetSpecialMove(501)); //new DeathStrike(); } } return(null); }
public override void OnSingleClick(Mobile from) { LabelTo(from, $"{SpellRegistry.GetInfo(SpellEntry).Name} scroll"); }
public override bool DoActionCombat() { Mobile combatant = m_Mobile.Combatant; if (combatant == null || combatant.Deleted || combatant.Map != m_Mobile.Map || !combatant.Alive || combatant.IsDeadBondedPet) { m_Mobile.DebugSay("My combatant is gone, so my guard is up"); Action = ActionType.Guard; return(true); } if (MoveTo(combatant, true, m_Mobile.RangeFight)) { m_Mobile.Direction = m_Mobile.GetDirectionTo(combatant); } else if (AcquireFocusMob(m_Mobile.RangePerception, m_Mobile.FightMode, false, false, true)) { if (m_Mobile.Debug) { m_Mobile.DebugSay("My move is blocked, so I am going to attack {0}", m_Mobile.FocusMob.Name); } m_Mobile.Combatant = m_Mobile.FocusMob; Action = ActionType.Combat; return(true); } else if (m_Mobile.GetDistanceToSqrt(combatant) > m_Mobile.RangePerception + 1) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I cannot find {0}, so my guard is up", combatant.Name); } Action = ActionType.Guard; return(true); } else { if (m_Mobile.Debug) { m_Mobile.DebugSay("I should be closer to {0}", combatant.Name); } } if (!m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee) { if (m_Mobile.Hits < m_Mobile.HitsMax * 20 / 100) { // We are low on health, should we flee? bool flee = false; if (m_Mobile.Hits < combatant.Hits) { // We are more hurt than them int diff = combatant.Hits - m_Mobile.Hits; flee = (Utility.Random(0, 100) < (10 + diff)); // (10 + diff)% chance to flee } else { flee = Utility.Random(0, 100) < 10; // 10% chance to flee } if (flee) { if (m_Mobile.Debug) { m_Mobile.DebugSay("I am going to flee from {0}", combatant.Name); } Action = ActionType.Flee; } } } if (combatant.Hits < (Utility.Random(10) + 10)) { if (CanUseAbility(25.0, 0, heChance)) { SpecialMove.SetCurrentMove(m_Mobile, SpellRegistry.GetSpecialMove(400)); // Honorable Execution return(true); } } UseSamuraiAbility(); return(true); }