public override void ExecuteAdd(TriggerBase trigger) { var monster = trigger.Get <MonsterTemplate>("monster"); var spell = trigger.Get <SpellTemplate>("spell"); var level = trigger.IsArgumentDefined("level") ? (int?)trigger.Get <int>("level") : null; WorldServer.Instance.IOTaskPool.AddMessage( () => { foreach (var grade in monster.Grades) { var spellLevel = Math.Min(level ?? (int)grade.GradeId, spell.SpellLevelsIds.Length + 1); var monsterSpell = new MonsterSpell() { SpellId = spell.Id, Level = (sbyte)spellLevel, MonsterGrade = grade, }; MonsterManager.Instance.AddMonsterSpell(monsterSpell); grade.SpellsTemplates.Add(monsterSpell); grade.ReloadSpells(); } trigger.Reply("Spell '{0}' added to '{1}'", spell.Name, monster.Name); }); }
protected override void CheckAIEvents() { m_castedSpell = false; for (Int32 i = 0; i < m_aiEvents.Count; i++) { m_aiEvents[i].Update(); } if (m_castShellNextTurn) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(24); if (CastSpell(p_spell)) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_castShellNextTurn = false; } } m_currentTreshholBlink += 0.03f; if (!m_castedSpell && Random.Value <= m_currentTreshholBlink) { MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(27); if (CastSpell(p_spell2)) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_currentTreshholBlink = 0f; m_castShellNextTurn = true; } } }
protected virtual Boolean DoCastSpell() { Boolean result = false; if (CanCastSpell() && CheckSpellCastChance()) { MonsterSpell monsterSpell = m_owner.SpellHandler.SelectSpell(); if (monsterSpell == null) { result = false; } else if (!CastSpell(monsterSpell)) { result = false; } else { m_owner.CombatHandler.CastedSpell = monsterSpell; m_owner.CombatHandler.CastSpell = true; if (monsterSpell.TargetType == ETargetType.PARTY) { m_owner.DivideAttacksToPartyCharacters = true; } m_owner.BuffHandler.DoOnCastSpellEffects(); result = true; } } return(result); }
private void OnHealAndVanishEvent() { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(21); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell); }
private void OnLifeEventTriggered() { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(29); if (CastSpell(p_spell)) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); } }
public CastMonsterSpellInteraction(SpawnCommand p_command, Int32 p_parentID, Int32 p_commandIndex) : base(p_command, p_parentID, p_commandIndex) { m_parent = Grid.FindInteractiveObject(m_parentID); m_interactiveObject = Grid.FindInteractiveObject(m_targetSpawnID); CreateDummyMonster(); m_spell = SpellFactory.CreateMonsterSpell((EMonsterSpell)m_spellID, String.Empty, 1); m_spell.MonsterMagicPower = m_magicFactor; m_dummyMonsterHandler.CastedSpell = m_spell; }
public void StartTurn() { m_spellTargetList.Clear(); LastCastedSpell = null; foreach (MonsterSpell monsterSpell in m_spells) { monsterSpell.StartTurn(); } }
public void AddSpell(MonsterSpell p_spell) { if (!m_spells.Contains(p_spell)) { p_spell.CriticalDamage = m_owner.StaticData.CriticalDamageSpells; p_spell.MonsterMagicPower = m_owner.MagicPower; p_spell.CriticalHitChance = m_owner.StaticData.CriticalHitChanceSpells; m_spells.Add(p_spell); } }
public void AddMonsterSpell(MonsterSpell spell) { base.Database.Insert(spell); System.Collections.Generic.List <MonsterSpell> list; if (!this.m_monsterSpells.TryGetValue(spell.MonsterGradeId, out list)) { this.m_monsterSpells.Add(spell.MonsterGradeId, list = new System.Collections.Generic.List <MonsterSpell>()); } list.Add(spell); }
public override Boolean CastSpell(MonsterSpell p_spell) { if (base.CastSpell(p_spell)) { m_owner.CombatHandler.CastedSpell = p_spell; m_owner.CombatHandler.CastSpell = true; if (p_spell.TargetType == ETargetType.PARTY) { m_owner.DivideAttacksToPartyCharacters = true; } m_owner.BuffHandler.DoOnCastSpellEffects(); m_owner.CombatHandler.DoAttack(); return(true); } return(false); }
protected override void CheckAIEvents() { m_castedSpell = false; for (Int32 i = 0; i < m_aiEvents.Count; i++) { m_aiEvents[i].Update(); } m_currentTreshholdWitheringBreath += TRESHHOLD_INCREMENT; if (!m_castedSpell && Random.Value <= m_currentTreshholdWitheringBreath) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(22); if (CastSpell(p_spell)) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_currentTreshholdWitheringBreath = RESET_TRESHHOLD; } } }
public override Boolean CastSpell(MonsterSpell p_spell) { if (CastSpellErebos(p_spell)) { m_owner.CombatHandler.CastedSpell = p_spell; m_owner.CombatHandler.CastSpell = true; if (p_spell.TargetType == ETargetType.PARTY) { m_owner.DivideAttacksToPartyCharacters = true; } m_owner.BuffHandler.DoOnCastSpellEffects(); m_owner.CombatHandler.DoAttack(); m_lastCastedSpell = p_spell.SpellType; m_state = EErebosState.SPELLCASTING; return(true); } return(false); }
private void HandlePhase1() { m_subStateFinished = false; switch (m_roundSubState) { case 1: if (!LegacyLogic.Instance.WorldManager.Party.InCombat) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(37); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell); } else if (m_owner.Direction == EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { m_roundSubState++; m_subStateFinished = true; } else { m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true); } break; case 2: case 3: if (LegacyLogic.Instance.WorldManager.Party.InCombat) { m_owner.CombatHandler.CastSpell = false; m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_owner.CombatHandler.DoAttack(); if (m_roundSubState == 3) { m_isFinished = true; } } else { m_subStateFinished = true; m_isFinished = true; m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED); } break; } }
public virtual Boolean CastSpell(MonsterSpell p_spell) { ETargetType targetType = p_spell.TargetType; if (targetType != ETargetType.SINGLE_MONSTER) { if (targetType != ETargetType.SINGLE_PARTY_MEMBER) { if (targetType != ETargetType.ALL_MONSTERS_ON_TARGET_SLOT) { if (targetType != ETargetType.PARTY) { return(false); } if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position, Position.Distance(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position) <= m_owner.StaticData.SpellRanges)) { m_owner.SpellHandler.LastCastedSpell = p_spell; return(true); } return(false); } } else { if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position, Position.Distance(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position) <= m_owner.StaticData.SpellRanges)) { m_owner.SpellHandler.LastCastedSpell = p_spell; return(true); } return(false); } } GridSlot slot = LegacyLogic.Instance.MapLoader.Grid.GetSlot(m_owner.Position); if (slot.Entities.Count > 0) { m_owner.SpellHandler.LastCastedSpell = p_spell; return(true); } return(false); }
private Boolean CastSpellErebos(MonsterSpell p_spell) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); ETargetType targetType = p_spell.TargetType; if (targetType != ETargetType.SINGLE_MONSTER) { if (targetType != ETargetType.SINGLE_PARTY_MEMBER) { if (targetType != ETargetType.ALL_MONSTERS_ON_TARGET_SLOT) { if (targetType != ETargetType.PARTY) { return(false); } if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position, true)) { return(true); } return(false); } } else { if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position, true)) { return(true); } return(false); } } GridSlot slot = LegacyLogic.Instance.MapLoader.Grid.GetSlot(m_owner.Position); if (slot.Entities.Count > 0) { return(true); } return(false); }
private void AttackParty() { if (m_decision == EMonsterStrategyDecision.MELEE || Position.Distance(LegacyLogic.Instance.WorldManager.Party.Position, m_owner.Position) < 1.1f) { if (m_state == EErebosState.APPEARING) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(28); CastSpell(p_spell); } else { m_state = EErebosState.IDLE; m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); DoMelee(true, LegacyLogic.Instance.WorldManager.Party, LegacyLogic.Instance.MapLoader.Grid, LegacyLogic.Instance.MapLoader.Grid.GetSlot(m_owner.Position)); } } else if (m_decision == EMonsterStrategyDecision.RANGED || Position.Distance(LegacyLogic.Instance.WorldManager.Party.Position, m_owner.Position) > 1.1f) { MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(20); CastSpell(p_spell2); m_state = EErebosState.SPELLCASTING; } }
public override void DoTurn(Grid p_grid, Party p_party) { m_owner.AbilityHandler.ExecuteAttacks(null, null, false, EExecutionPhase.BEGIN_OF_MONSTERS_TURN); m_owner.AbilityHandler.FlushActionLog(EExecutionPhase.BEGIN_OF_MONSTERS_TURN); m_owner.BuffHandler.ModifyMonsterValues(); m_owner.CombatHandler.MeleeStrikes += m_owner.CombatHandler.MeleeStrikesRoundBonus; m_owner.CombatHandler.MeleeStrikesRoundBonus = 0; CheckAIEvents(); if (!m_castedSpell) { if (Position.Distance(m_owner.Position, p_party.Position) < 1.1f) { DoMelee(true, p_party, p_grid, p_grid.GetSlot(m_owner.Position)); } else if (p_grid.LineOfSight(m_owner.Position, p_party.Position)) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(23); if (CastSpell(p_spell)) { m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); } } } }
public override Boolean CastSpell(MonsterSpell p_spell) { return(false); }
public void RemoveMonsterSpell(MonsterSpell spell) { base.Database.Delete(spell); this.m_monsterSpells.Remove(spell.Id); }
private void HandlePhase2() { m_subStateFinished = false; switch (m_roundSubState) { case 0: if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT)) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(36); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_castedFlickeringLight = true; CastSpell(p_spell); } else { m_roundSubState++; m_subStateFinished = true; } break; case 1: if (!LegacyLogic.Instance.WorldManager.Party.InCombat) { MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(37); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell2); } else { m_roundSubState++; m_subStateFinished = true; } break; case 2: if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true); } else { m_roundSubState++; m_subStateFinished = true; } break; case 3: if (!m_castedFlickeringLight && LegacyLogic.Instance.WorldManager.Party.InCombat) { MonsterSpell p_spell3 = m_owner.SpellHandler.SelectSpellByID(34); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell3); } else { m_roundSubState++; m_subStateFinished = true; } break; case 4: if (LegacyLogic.Instance.WorldManager.Party.InCombat) { m_owner.CombatHandler.CastSpell = false; m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_owner.CombatHandler.DoAttack(); } else { m_isFinished = true; m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED); } break; case 5: m_owner.m_stateMachine.ChangeState(Monster.EState.ACTION_FINISHED); m_isFinished = true; break; } }
private static Int32 SortDesc(MonsterSpell p_spellA, MonsterSpell p_spellB) { return(p_spellB.CastProbability.CompareTo(p_spellA.CastProbability)); }
private void HandlePhase3() { m_subStateFinished = false; if (!m_strategyA) { switch (m_roundSubState) { case 0: if (LegacyLogic.Instance.WorldManager.Party.InCombat) { if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { m_owner.Rotate(EDirectionFunctions.RotationCount(m_owner.Direction, EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)), true); } else { m_roundSubState++; m_subStateFinished = true; } } else { m_roundSubState++; m_subStateFinished = true; } break; case 1: if (!LegacyLogic.Instance.WorldManager.Party.InCombat) { m_strategyA = true; m_roundSubState = 0; } else if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT)) { MonsterSpell p_spell = m_owner.SpellHandler.SelectSpellByID(36); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell); } else { m_owner.CombatHandler.CastSpell = false; m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_owner.CombatHandler.DoAttack(); } break; case 2: m_owner.CombatHandler.CastSpell = false; m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); m_owner.CombatHandler.DoAttack(); break; case 3: { MonsterSpell p_spell2 = m_owner.SpellHandler.SelectSpellByID(37); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell2); break; } } if (m_roundSubState >= 4) { m_isFinished = true; m_owner.m_stateMachine.ChangeState(Monster.EState.IDLE); LegacyLogic.Instance.WorldManager.Party.InCombat = LegacyLogic.Instance.MapLoader.Grid.CheckInCombat(LegacyLogic.Instance.WorldManager.Party.Position); m_strategyA = !m_strategyA; return; } } if (m_strategyA) { switch (m_roundSubState) { case 0: if (!m_owner.BuffHandler.HasBuff(EMonsterBuffType.FLICKERING_LIGHT)) { MonsterSpell p_spell3 = m_owner.SpellHandler.SelectSpellByID(36); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell3); } else { m_roundSubState++; m_subStateFinished = true; } break; case 1: if (LegacyLogic.Instance.WorldManager.Party.InCombat || LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { m_owner.Rotate(EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position), true); } else { m_roundSubState++; m_subStateFinished = true; } } else { m_roundSubState++; m_subStateFinished = true; } break; case 2: if (!LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { MonsterSpell p_spell4 = m_owner.SpellHandler.SelectSpellByID(37); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell4); m_castedFlicker = true; } else { MonsterSpell p_spell5 = m_owner.SpellHandler.SelectSpellByID(34); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell5); } break; case 3: if (m_owner.Direction != EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { m_owner.Rotate(EDirectionFunctions.GetDirection(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position), true); } if (LegacyLogic.Instance.MapLoader.Grid.LineOfSight(m_owner.Position, LegacyLogic.Instance.WorldManager.Party.Position)) { MonsterSpell p_spell6 = m_owner.SpellHandler.SelectSpellByID(34); m_owner.m_stateMachine.ChangeState(Monster.EState.MOVING); CastSpell(p_spell6); } else { m_roundSubState++; m_subStateFinished = true; } break; } if (m_roundSubState >= 4) { m_isFinished = true; m_owner.m_stateMachine.ChangeState(Monster.EState.IDLE); m_strategyA = !m_strategyA; } } }
public void SetEntry(MonsterStaticData p_data, Int32 p_amountKilled) { m_stages = p_data.BestiaryThresholds; m_currentAmount = p_amountKilled; if (p_data.Grade == EMonsterGrade.CHAMPION || p_data.Grade == EMonsterGrade.BOSS) { m_currentAmount = p_data.BestiaryThresholds[2]; } m_progressBar.SetCurrentAmount(m_currentAmount, p_data.BestiaryThresholds[2]); Int32 num; if (LegacyLogic.Instance.WorldManager.Difficulty == EDifficulty.HARD) { switch (p_data.Grade) { case EMonsterGrade.CORE: num = (Int32)(p_data.MaxHealthpoints * ConfigManager.Instance.Game.MonsterHealthCoreFactor); break; case EMonsterGrade.ELITE: num = (Int32)(p_data.MaxHealthpoints * ConfigManager.Instance.Game.MonsterHealthEliteFactor); break; case EMonsterGrade.CHAMPION: num = (Int32)(p_data.MaxHealthpoints * ConfigManager.Instance.Game.MonsterHealthChampionFactor); break; default: num = p_data.MaxHealthpoints; break; } } else { num = p_data.MaxHealthpoints; } String p_text = String.Empty; if (p_data.MeleeAttackDamageMin == p_data.MeleeAttackDamageMax) { p_text = p_data.MeleeAttackDamageMin.ToString(); } else { p_text = p_data.MeleeAttackDamageMin + "-" + p_data.MeleeAttackDamageMax; } m_maxHp.UpdateLabel(num.ToString(), LocaManager.GetText("BESTIARY_STAT_ATTRIBUTE_HEALTH_TT")); m_meleeDmg.UpdateLabel(p_text, LocaManager.GetText("BESTIARY_STAT_ATTACK_DAMAGE_TT")); m_meleeStrikes.UpdateLabel(p_data.MeleeAttackStrikesAmount.ToString(), LocaManager.GetText("BESTIARY_STAT_STRIKES_TT")); m_critMelee.UpdateLabel(p_data.CriticalDamageMelee.ToString(), LocaManager.GetText("BESTIARY_STAT_ATTACK_CRIT_DAMAGE_TT", p_data.CriticalDamageMelee * 100f)); m_meleeAttackValue.UpdateLabel(p_data.MeleeAttackValue.ToString(), LocaManager.GetText("BESTIARY_STAT_ATTACK_VALUE_TT")); for (Int32 i = 0; i < m_spells.Count; i++) { m_spells[i].ShowEntry(true); if (p_data.Spells.Length > i) { MonsterSpellStaticData staticData = StaticDataHandler.GetStaticData <MonsterSpellStaticData>(EDataType.MONSTER_SPELLS, p_data.Spells[i].SpellID); MonsterSpell monsterSpell = SpellFactory.CreateMonsterSpell((EMonsterSpell)staticData.StaticID, staticData.EffectKey, p_data.Spells[i].SpellProbability); m_spells[i].ShowEntry(true); m_spells[i].UpdateEntry(staticData.Icon); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(m_headLineColorHex); stringBuilder.Append(LocaManager.GetText(monsterSpell.NameKey)); stringBuilder.Append("[-]"); stringBuilder.Append(Environment.NewLine); stringBuilder.Append(m_textColorHex); stringBuilder.Append(monsterSpell.GetDescriptionForCaster(p_data)); stringBuilder.Append("[-]"); m_spells[i].SetTooltip(stringBuilder.ToString()); } else { m_spells[i].ShowEntry(false); } } if (p_data.AttackRange > 1 && p_data.Spells.Length == 0) { m_rangeDmg.gameObject.SetActive(true); m_rangeStrikes.gameObject.SetActive(true); m_rangeAttackValue.gameObject.SetActive(true); m_rangeAttackRange.gameObject.SetActive(true); m_critRange.gameObject.SetActive(true); m_critMagic.gameObject.SetActive(false); String p_text2 = String.Empty; if (p_data.RangedAttackDamageMin == p_data.RangedAttackDamageMax) { p_text2 = p_data.RangedAttackDamageMin.ToString(); } else { p_text2 = p_data.RangedAttackDamageMin + "-" + p_data.RangedAttackDamageMax; } m_rangeDmg.UpdateLabel(p_text2, LocaManager.GetText("BESTIARY_STAT_ATTACK_DAMAGE_TT", p_data.RangedAttackDamage.Value.ToString())); m_rangeStrikes.UpdateLabel(p_data.RangedAttackStrikesAmount.ToString(), LocaManager.GetText("BESTIARY_STAT_STRIKES_TT", p_data.RangedAttackStrikesAmount.ToString())); m_rangeAttackValue.UpdateLabel(p_data.RangedAttackValue.ToString(), LocaManager.GetText("BESTIARY_STAT_ATTACK_VALUE_TT", p_data.RangedAttackValue.ToString())); m_rangeAttackRange.UpdateLabel(p_data.AttackRange.ToString(), LocaManager.GetText("MONSTER_ATTACK_RANGE_TT", p_data.AttackRange.ToString())); m_critRange.UpdateLabel(p_data.CriticalDamageRanged.ToString(), LocaManager.GetText("BESTIARY_STAT_ATTACK_CRIT_DAMAGE_TT", p_data.CriticalDamageRanged * 100f)); m_labelRangedMagic.text = LocaManager.GetText("GUI_CHARACTER_STATS_RANGED"); for (Int32 j = 0; j < m_spells.Count; j++) { m_spells[j].ShowEntry(false); } } else if (p_data.Spells.Length > 0) { m_rangeDmg.gameObject.SetActive(false); m_rangeStrikes.gameObject.SetActive(false); m_rangeAttackValue.gameObject.SetActive(false); m_rangeAttackRange.gameObject.SetActive(false); m_critRange.gameObject.SetActive(false); m_critMagic.gameObject.SetActive(true); m_labelRangedMagic.text = LocaManager.GetText("GUI_CHARACTER_STATS_MAGIC"); } else { m_rangeDmg.gameObject.SetActive(true); m_rangeStrikes.gameObject.SetActive(true); m_rangeAttackValue.gameObject.SetActive(true); m_rangeAttackRange.gameObject.SetActive(true); m_critRange.gameObject.SetActive(true); m_critMagic.gameObject.SetActive(false); for (Int32 k = 0; k < m_spells.Count; k++) { m_spells[k].ShowEntry(false); } m_labelRangedMagic.text = LocaManager.GetText("GUI_CHARACTER_STATS_RANGED"); m_rangeDmg.UpdateLabel("-", LocaManager.GetText("BESTIARY_STAT_ATTACK_DAMAGE_TT", "-")); m_rangeStrikes.UpdateLabel("-", LocaManager.GetText("BESTIARY_STAT_STRIKES_TT", "-")); m_rangeAttackValue.UpdateLabel("-", LocaManager.GetText("BESTIARY_STAT_ATTACK_VALUE_TT", "-")); m_rangeAttackRange.UpdateLabel("-", LocaManager.GetText("MONSTER_ATTACK_RANGE_TT", "-")); m_critRange.UpdateLabel("-", LocaManager.GetText("BESTIARY_STAT_ATTACK_CRIT_DAMAGE_TT", "-")); } m_armor.UpdateLabel(p_data.ArmorValue.ToString(), LocaManager.GetText("BESTIARY_STAT_ARMOR_VALUE_TT", p_data.ArmorValue.ToString())); m_blockAttempts.UpdateLabel(p_data.GeneralBlockAttemptsPerTurn.ToString(), LocaManager.GetText("BESTIARY_STAT_BLOCK_ATTEMPTS_TT", p_data.GeneralBlockAttemptsPerTurn.ToString())); m_evade.UpdateLabel(p_data.EvadeValue.ToString(), LocaManager.GetText("BESTIARY_STAT_EVADE_VALUE_TT", p_data.EvadeValue.ToString())); if (p_data.CriticalDamageSpells > 0f) { m_critMagic.UpdateLabel(p_data.CriticalDamageSpells.ToString(), LocaManager.GetText("BESTIARY_STAT_MAGIC_CRIT_CHANCE_TT", p_data.CriticalDamageSpells * 100f)); } else { m_critMagic.UpdateLabel("-", LocaManager.GetText("BESTIARY_STAT_MAGIC_CRIT_CHANCE_TT", "-")); } NGUITools.SetActive(m_abilityFrame, true); if (p_data.Abilities.Length == 0) { NGUITools.SetActive(m_abilityFrame, false); } for (Int32 l = 0; l < m_specials.Count; l++) { if (p_data.Abilities.Length > l) { m_specials[l].ShowEntry(true); MonsterAbilityBase monsterAbilityBase = AbilityFactory.CreateMonsterAbility(p_data.Abilities[l].AbilityType, p_data.MagicPower); monsterAbilityBase.Level = p_data.Abilities[l].Level; m_specials[l].UpdateEntry(monsterAbilityBase.StaticData.Icon); StringBuilder stringBuilder2 = new StringBuilder(); stringBuilder2.Append(m_headLineColorHex); stringBuilder2.Append(LocaManager.GetText(monsterAbilityBase.StaticData.NameKey)); stringBuilder2.Append("[-]"); stringBuilder2.Append(Environment.NewLine); stringBuilder2.Append(m_textColorHex); stringBuilder2.Append(monsterAbilityBase.GetDescription()); stringBuilder2.Append("[-]"); m_specials[l].SetTooltip(stringBuilder2.ToString()); } else { m_specials[l].ShowEntry(false); } } m_resiPrimordial.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_PRIMORDIAL_TT", 0, 0)); m_resiFire.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_FIRE_TT", 0, 0)); m_resiWater.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_WATER_TT", 0, 0)); m_resiEarth.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_EARTH_TT", 0, 0)); m_resiAir.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_AIR_TT", 0, 0)); m_resiLight.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_LIGHT_TT", 0, 0)); m_resiDark.UpdateLabel("0", LocaManager.GetText("BESTIARY_STAT_RESISTANCE_DARK_TT", 0, 0)); foreach (Resistance resistance in p_data.MagicResistances) { switch (resistance.Type) { case EDamageType.AIR: m_resiAir.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_AIR_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.EARTH: m_resiEarth.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_EARTH_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.FIRE: m_resiFire.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_FIRE_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.WATER: m_resiWater.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_WATER_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.DARK: m_resiDark.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_DARK_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.LIGHT: m_resiLight.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_LIGHT_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; case EDamageType.PRIMORDIAL: m_resiPrimordial.UpdateLabel(resistance.Value.ToString(), LocaManager.GetText("BESTIARY_STAT_RESISTANCE_PRIMORDIAL_TT", resistance.Value * (p_data.EvadeValue / 100), resistance.Value)); break; } } HideLockedEntries(); }
protected virtual void OnEntityCastSpell(Object p_sender, EventArgs p_args) { if (p_sender != MyController) { return; } SpellEventArgs args = (SpellEventArgs)p_args; MonsterSpell spell = (MonsterSpell)args.Spell; EventHandler eventHandler = delegate(Object sender, EventArgs e) { DelayedEventManager.InvokeEvent(EDelayType.ON_FX_HIT, EEventType.MONSTER_CAST_SPELL, p_sender, args); MyController.AttackingDone.Trigger(); if (spell.SpellType == EMonsterSpell.FLICKER) { m_MainView.SetEntityPosition(); } if (MyController is Monster) { ((Monster)MyController).BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_CAST_SPELL); ((Monster)MyController).BuffHandler.RemoveFlaggedBuffs(); } SpellEffectEntryEventArgs p_args9 = new SpellEffectEntryEventArgs(p_sender, args); LegacyLogic.Instance.ActionLog.PushEntry(p_args9); foreach (SpellTarget spellTarget2 in args.SpellTargets) { if (spellTarget2.Target is Character) { ((Character)spellTarget2.Target).ConditionHandler.FlushActionLog(); ((Character)spellTarget2.Target).ConditionHandler.FlushDelayedActionLog(); LegacyLogic.Instance.WorldManager.Party.Buffs.FlushActionLog(); } } if (MyController is Monster) { ((Monster)MyController).BuffHandler.FlushActionLog(MonsterBuffHandler.ELogEntryPhase.ON_END_TURN); } }; FXDescription fxdescription = Helper.ResourcesLoad <FXDescription>(spell.EffectKey, false); if (fxdescription == null) { Debug.LogError("FXDescription not found! at " + spell.EffectKey, this); eventHandler(this, EventArgs.Empty); return; } fxdescription = Helper.Instantiate <FXDescription>(fxdescription); fxdescription.Finished += eventHandler; Vector3 p_slotOriginPosition; Vector3 p_slotForward; Vector3 p_slotLeft; Vector3 p_slotTargetPosition; ViewManager.GetSlotDatas(MyController.Position, LegacyLogic.Instance.WorldManager.Party.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); Int32 animationID; if (Int32.TryParse(spell.EffectAnimationClip, out animationID)) { m_animatorControl.AttackMagic(animationID); } else { Debug.LogError("Error parse animation id for attack magic '" + spell.EffectAnimationClip + "'"); m_animatorControl.AttackMagic(); } GameObject gameObject = this.gameObject; ETargetType targetType = spell.TargetType; if (args.SpellTargets.Count == 0) { Debug.LogError("Error, missing targets for effects\n" + DebugUtil.DumpObjectText(spell)); FXArgs p_args2 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject> { gameObject }); fxdescription.Configurate(m_eventHandler, p_args2); return; } if ((targetType & ETargetType.MONSTER) == ETargetType.MONSTER) { PlayerEntityView playerEntityView = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party); MovingEntity movingEntity = null; List <GameObject> list = new List <GameObject>(); foreach (SpellTarget spellTarget in args.SpellTargets) { GameObject gameObject2 = null; if (spellTarget.Target is Character) { if (movingEntity == null) { movingEntity = LegacyLogic.Instance.WorldManager.Party; } gameObject2 = playerEntityView.GetMemberGameObject(((Character)spellTarget.Target).Index); } else if (spellTarget.Target is MovingEntity) { if (movingEntity == null) { movingEntity = (MovingEntity)spellTarget.Target; } gameObject2 = ViewManager.Instance.FindView((MovingEntity)spellTarget.Target); } if (gameObject2 != null) { list.Add(gameObject2); } } ViewManager.GetSlotDatas(MyController.Position, movingEntity.Position, out p_slotOriginPosition, out p_slotForward, out p_slotLeft, out p_slotTargetPosition); FXArgs p_args3 = new FXArgs(gameObject, playerEntityView.gameObject, gameObject, playerEntityView.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list); fxdescription.Configurate(m_eventHandler, p_args3); } else if ((targetType & ETargetType.MULTY) == ETargetType.MULTY) { PlayerEntityView playerEntityView2 = ViewManager.Instance.FindViewAndGetComponent <PlayerEntityView>(LegacyLogic.Instance.WorldManager.Party); List <GameObject> list2 = new List <GameObject>(4); for (Int32 i = 0; i < 4; i++) { list2.Add(playerEntityView2.GetMemberGameObject(i)); } FXArgs p_args4 = new FXArgs(gameObject, playerEntityView2.gameObject, gameObject, playerEntityView2.gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, list2); fxdescription.Configurate(m_eventHandler, p_args4); } else if ((targetType & ETargetType.SINGLE) == ETargetType.SINGLE) { Boolean flag = true; foreach (AttackedTarget attackedTarget in args.SpellTargetsOfType <AttackedTarget>()) { Character character = (Character)attackedTarget.Target; GameObject characterGO = FXHelper.GetCharacterGO(character.Index); if (!flag) { fxdescription = Helper.Instantiate <FXDescription>(fxdescription); } FXArgs p_args5 = new FXArgs(gameObject, characterGO, gameObject, characterGO, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject> { characterGO }); fxdescription.Configurate(m_eventHandler, p_args5); flag = false; } foreach (MonsterBuffTarget monsterBuffTarget in args.SpellTargetsOfType <MonsterBuffTarget>()) { Character character2 = (Character)monsterBuffTarget.Target; GameObject characterGO2 = FXHelper.GetCharacterGO(character2.Index); if (!flag) { fxdescription = Helper.Instantiate <FXDescription>(fxdescription); } FXArgs p_args6 = new FXArgs(gameObject, characterGO2, gameObject, characterGO2, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition, new List <GameObject> { characterGO2 }); fxdescription.Configurate(m_eventHandler, p_args6); flag = false; } } else if ((targetType & ETargetType.ADJACENT) == ETargetType.ADJACENT) { FXArgs p_args7 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition); fxdescription.Configurate(m_eventHandler, p_args7); } else { FXArgs p_args8 = new FXArgs(gameObject, gameObject, gameObject, gameObject, p_slotOriginPosition, p_slotForward, p_slotLeft, p_slotTargetPosition); fxdescription.Configurate(m_eventHandler, p_args8); } }