예제 #1
0
 /// <summary>
 /// Notifies the spell that it has been cast on a given target
 /// </summary>        
 public void CastAt(GameActionFightSpellCastMessage msg)
 {
     if (msg == null) throw new ArgumentNullException("msg");
     Spell spell = GetSpell(msg.spellId);
     if (spell == null)
         throw new ArgumentException(String.Format("Spell Id {0} do not exists in the SpellsBook of {1}, with {2} entries", msg.spellId, Character.Name, m_spells.Count));
     spell.CastAt(msg.targetId);
     //Character.SendMessage(string.Format("Spell {0} cast at actor Id {1}. Still available : {2}", spell, msg.targetId, spell.IsAvailable(msg.targetId)));
 }
예제 #2
0
        public void HandleGameActionFightSpellCastMessage(Bot bot, GameActionFightSpellCastMessage message)
        {
            var fighter = bot.Character.Fight.GetFighter(message.sourceId);

            if (fighter == null)
                logger.Error("Fighter {0} cast a spell but doesn't exist", message.sourceId);
            else
            {
                fighter.NotifySpellCasted(new SpellCast(bot.Character.Fight, message));
            }
        }
예제 #3
0
        public SpellCast(Fight fight, GameActionFightSpellCastMessage msg)
        {
            Caster = fight.GetFighter(msg.sourceId);

            if (Caster == null)
                logger.Error("Fighter {0} not found as he casted spell {1}", msg.sourceId, msg.spellId);

            Spell = DataProvider.Instance.Get<Spell>(msg.spellId);
            SpellLevel = DataProvider.Instance.Get<SpellLevel>((int)Spell.spellLevels[msg.spellLevel - 1]);
            Target = fight.Map.Cells[msg.destinationCellId];
            RoundCast = fight.Round;
            Critical = (FightSpellCastCriticalEnum) msg.critical;
            SilentCast = msg.silentCast;
            TargetedFighter = fight.GetFighter(msg.targetId);
        }
예제 #4
0
        public static void HandleGameActionFightSpellCastMessage(Bot bot, GameActionFightSpellCastMessage message)
        {
            if (bot == null || bot.Character == null || bot.Character.Fight == null)
            {
                logger.Error("Fight is not properly initialized.");
                return; // Can't handle the message
            }
            var fighter = bot.Character.Fight.GetFighter(message.sourceId);

            if (fighter == null)
                logger.Error("Fighter {0} cast a spell but doesn't exist", message.sourceId);
            else
            {
                fighter.NotifySpellCasted(new SpellCast(bot.Character.Fight, message));
                if (bot.Character.Fighter != null && bot.Character.Fighter.Id == message.sourceId)
                    bot.Character.SpellsBook.CastAt(message);

            }
        }
예제 #5
0
 public static void HandleGameActionFightSpellCastMessage(Bot bot, GameActionFightSpellCastMessage message)
 {
 }