public static SpecialMove GetCurrentMove(Mobile m) { if (m == null) { return(null); } if (!Core.SE) { ClearCurrentMove(m); return(null); } SpecialMove move = null; m_Table.TryGetValue(m, out move); if (move != null && move.ValidatesDuringHit && !move.Validate(m)) { ClearCurrentMove(m); return(null); } return(move); }
public static bool SetCurrentMove(Mobile m, SpecialMove move) { if (!Core.SE) { ClearCurrentMove(m); return(false); } if (move != null && !move.Validate(m)) { ClearCurrentMove(m); return(false); } bool sameMove = (move == GetCurrentMove(m)); ClearCurrentMove(m); if (sameMove) { return(true); } if (move != null) { WeaponAbility.ClearCurrentAbility(m); m_Table[m] = move; move.OnUse(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, true)); } TextDefinition.SendMessageTo(m, move.AbilityMessage); } return(true); }
public static void ClearCurrentMove(Mobile m) { SpecialMove move = null; m_Table.TryGetValue(m, out move); if (move != null) { move.OnClearMove(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, false)); } } m_Table.Remove(m); }
public static void Register(int spellID, Type type) { if (spellID < 0 || spellID >= m_Types.Length) { return; } if (m_Types[spellID] == null) { ++m_Count; } m_Types[spellID] = type; if (!m_IDsFromTypes.ContainsKey(type)) { m_IDsFromTypes.Add(type, spellID); } if (type.IsSubclassOf(typeof(SpecialMove))) { SpecialMove spm = null; try { spm = Activator.CreateInstance(type) as SpecialMove; } catch { } if (spm != null) { m_SpecialMoves.Add(spellID, spm); } } }
public static int GetRegistryNumber(SpecialMove s) { return(GetRegistryNumber(s.GetType())); }