public override bool HandlePacket(Peer peer, byte[] data) { var spell = new CastSpellRequest(data); var targetObj = _game.ObjectManager.GetObjectById(spell.targetNetId); var TargetUnit = targetObj as AttackableUnit; var owner = _playerManager.GetPeerInfo(peer).Champion; if (owner == null) { return(false); } if (!owner.CanCast()) { return(false); } var s = owner.GetSpell(spell.spellSlot); if (s == null) { return(false); } return(s.cast(spell.x, spell.y, spell.x2, spell.y2, TargetUnit)); }
public GameResponse CastSpell([FromBody] CastSpellRequest request) { Game game = (Game)MemoryCacher.GetValue(request.GameId); game.CastSpell(request.PlayerId, request.CardId, request.Targets); return(new GameResponse(game)); }
public static void InvokeCastSpellRequest(Mobile m, int spellID, Item book) => CastSpellRequest?.Invoke(m, spellID, book);
public static void InvokeCastSpellRequest(CastSpellRequestEventArgs e) { CastSpellRequest?.Invoke(e); }