private void GainFromDealtDamage(SuffixStaticData p_suffix) { Int32 suffixLevel = m_equipment.SuffixLevel; Single valueForLevel = p_suffix.GetValueForLevel(suffixLevel, m_equipment.ItemSlot == EItemSlot.ITEM_SLOT_2_HAND); Single num = m_attackResult.DamageDone; EnchantmentEffectEventArgs suffixEffectEntry; if (p_suffix.Effect == ESuffixEffect.GAIN_HP_PERCENTAGE_FROM_DEALT_DAMAGE) { Int32 num2 = Math.Max(1, (Int32)Math.Round(num * valueForLevel, MidpointRounding.AwayFromZero)); m_character.ChangeHP(num2); suffixEffectEntry = new EnchantmentEffectEventArgs(p_suffix, num2); DamageEventArgs p_eventArgs = new DamageEventArgs(new AttackResult { Result = EResultType.HEAL, DamageResults = { new DamageResult(EDamageType.HEAL, num2, 0, 1f) } }); LegacyLogic.Instance.EventManager.InvokeEvent(m_character, EEventType.CHARACTER_HEALS, p_eventArgs); } else { Int32 num3 = Math.Max(1, (Int32)Math.Round(num * valueForLevel, MidpointRounding.AwayFromZero)); m_character.ChangeMP(num3); suffixEffectEntry = new EnchantmentEffectEventArgs(p_suffix, num3); } m_character.FightHandler.FeedActionLog(suffixEffectEntry); }
private void ResolveNormalHitEffects(SuffixStaticData p_suffix) { if (p_suffix.ConditionHits == EHitTypeCondition.SUCCESSFUL) { ResolveSuffixEffects(p_suffix, false); } }
private void RemoveAllBlockAttempts(SuffixStaticData p_suffix) { m_target.CurrentGeneralBlockAttempts = 0; m_target.CurrentMeleeBlockAttempts = 0; EnchantmentEffectEventArgs suffixEffectEntry = new EnchantmentEffectEventArgs(p_suffix); m_character.FightHandler.FeedActionLog(suffixEffectEntry); }
private void TargetDealMagicDamageOnTile(SuffixStaticData p_suffix) { Int32 suffixLevel = m_equipment.SuffixLevel; Int32 damageValue = (Int32)Math.Round(p_suffix.GetValueForLevel(suffixLevel, m_equipment.ItemSlot == EItemSlot.ITEM_SLOT_2_HAND), MidpointRounding.AwayFromZero); EnchantmentEffectEventArgs suffixEffectEntry = new EnchantmentEffectEventArgs(p_suffix); m_character.FightHandler.FeedActionLog(suffixEffectEntry); m_character.FightHandler.AttackAllMonstersOnTargetsTile(m_target, damageValue, p_suffix.MagicSchool, m_counterAttack); }
private void AfflictDebuff(Monster p_target, EMonsterBuffType p_buff, SuffixStaticData p_suffix, Boolean p_buffEndDelayed) { if (p_suffix.MagicSchool != EDamageType.NONE && p_target.CombatHandler.TestEvadeSpell(p_suffix.MagicSchool, 0)) { return; } MonsterBuff monsterBuff = BuffFactory.CreateMonsterBuff(p_buff, p_suffix.GetValueForLevel(m_equipment.SuffixLevel, m_equipment.ItemSlot == EItemSlot.ITEM_SLOT_2_HAND)); monsterBuff.Causer = m_character; monsterBuff.DontTriggerOnFirstDamage = true; if (p_buffEndDelayed) { monsterBuff.Duration++; } p_target.AddBuff(monsterBuff); LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.ITEM_SUFFIX_APPLY_BUFF, new ItemSuffixApplyBuffEventArgs(p_target, p_suffix.Description, p_buff)); MonsterBuffEntryEventArgs item = new MonsterBuffEntryEventArgs(p_target, monsterBuff, p_target.BuffHandler.HasBuff(monsterBuff)); m_logEntries.Add(item); }
public void OnAddToInventoryButtonClick() { BaseItem baseItem = ItemFactory.CreateItem(m_currentDataType); Int32 index = m_itemList.items.IndexOf(m_itemList.selection); baseItem.Init(m_staticIdList[index]); if (m_isEquipment) { Equipment equipment = baseItem as Equipment; if (equipment != null) { Int32 num = Int32.Parse(m_prefixList.selection.Split(new Char[] { ':' })[0]); if (num != 0) { PrefixStaticData staticData = StaticDataHandler.GetStaticData <PrefixStaticData>(EDataType.PREFIX, num); equipment.Prefixes.Add(staticData); } Int32 num2 = Int32.Parse(m_suffixList.SelectedItem.Split(new Char[] { ':' })[0]); if (num2 != 0) { SuffixStaticData staticData2 = StaticDataHandler.GetStaticData <SuffixStaticData>(EDataType.SUFFIX, num2); equipment.Suffixes.Add(staticData2); } } equipment.Broken = m_checkboxBroken.isChecked; equipment.Identified = !m_checkboxUnidentified.isChecked; } Party party = LegacyLogic.Instance.WorldManager.Party; party.Inventory.AddItem(baseItem); }
public EnchantmentEffectEventArgs(SuffixStaticData p_suffixData) : this(p_suffixData, 0f) { }
public EnchantmentEffectEventArgs(SuffixStaticData p_suffixData, Single p_effectValue) { EffectData = p_suffixData; EffectValue = p_effectValue; }
private void AfflictDebuffOnTargetTile(Monster p_target, EMonsterBuffType p_buff, SuffixStaticData p_suffix, Boolean p_buffEndDelayed) { List <Monster> allMonstersOnTargetTile = LegacyLogic.Instance.WorldManager.Party.GetAllMonstersOnTargetTile(p_target); foreach (Monster p_target2 in allMonstersOnTargetTile) { AfflictDebuff(p_target2, p_buff, p_suffix, p_buffEndDelayed); } }
private void ResolveSuffixEffects(SuffixStaticData p_suffix, Boolean p_buffEndDelayed) { switch (p_suffix.Effect) { case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_CHILLED: AfflictDebuff(m_target, EMonsterBuffType.CHILLED, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_IMMOBILISED: AfflictDebuff(m_target, EMonsterBuffType.IMMOBILISED, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_IMMOBILISED_GROUP: AfflictDebuffOnTargetTile(m_target, EMonsterBuffType.IMMOBILISED, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_MANASURGE: AfflictDebuff(m_target, EMonsterBuffType.MANASURGE, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_MEMORYGAP: AfflictDebuff(m_target, EMonsterBuffType.MEMORYGAP, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_POISON: AfflictDebuff(m_target, EMonsterBuffType.POISONED, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_SLEEP: AfflictDebuff(m_target, EMonsterBuffType.SLEEPING, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_IMPRISSONED: AfflictDebuff(m_target, EMonsterBuffType.IMPRISONED, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_ACIDSPLASH: AfflictDebuff(m_target, EMonsterBuffType.ACIDSPLASH, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_WEAKNESS: AfflictDebuff(m_target, EMonsterBuffType.WEAKNESS, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_AGONY: AfflictDebuff(m_target, EMonsterBuffType.AGONY, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_TERROR: AfflictDebuff(m_target, EMonsterBuffType.TERROR, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_SUNDERING: AfflictDebuff(m_target, EMonsterBuffType.SUNDERING, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_STUNNED: AfflictDebuff(m_target, EMonsterBuffType.MACE_STUN, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_GASH: AfflictDebuff(m_target, EMonsterBuffType.GASH, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.AFFLICT_MONSTER_DEBUFF_PROVOKE: AfflictDebuff(m_target, EMonsterBuffType.PROVOKE, p_suffix, p_buffEndDelayed); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_AIR: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_EARTH: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_WATER: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_FIRE: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_DARKNESS: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_LIGHT: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.HIT_TILE_MONSTERS_MAGIC_DAMAGE_PRIMORDIAL: TargetDealMagicDamageOnTile(p_suffix); break; case ESuffixEffect.LOSE_ALL_BLOCK_ATTEMPTS: RemoveAllBlockAttempts(p_suffix); break; case ESuffixEffect.GAIN_HP_PERCENTAGE_FROM_DEALT_DAMAGE: GainFromDealtDamage(p_suffix); break; case ESuffixEffect.GAIN_MP_PERCENTAGE_FROM_DEALT_DAMAGE: GainFromDealtDamage(p_suffix); break; } }
private Boolean IsEffectTriggered(SuffixStaticData p_suffix) { Single chanceForLevel = p_suffix.GetChanceForLevel(m_equipment.SuffixLevel, m_equipment.ItemSlot == EItemSlot.ITEM_SLOT_2_HAND); return(chanceForLevel > 0f && (chanceForLevel >= 1f || !p_suffix.HasCondition() || Random.Range(0f, 1f) < chanceForLevel)); }