public static BattleObjStats operator -(BattleObjStats a, BattleObjStats b) { BattleObjStats c = new BattleObjStats(0, a.maxHp - b.maxHp, a.damage - b.damage, 0, a.maxShield - b.maxShield); c.SetHP(a.hp - b.hp); c.SetShield(a.shield - b.shield); return c; }
public void UpdateStats(SpellEffectInfo effectInfo, bool isFinal) { DivineDebug.Log("Update Stats for: "); DivineDebug.Log("CurrentHP: " + _currentStats.hp + " FinalHP: " + effectInfo.finalCharacterStats.hp + " IsFinal: " + isFinal); if ((effectInfo.isMultiPart && isFinal) || !effectInfo.isMultiPart) { _currentStats = effectInfo.finalCharacterStats; DivineDebug.Log("moniker " + moniker + " hp: " + _currentStats.hp + " shield: " + _currentStats.shield + " damage: " + _currentStats.damage); charInfo.SetBaseStats(_currentStats.hp, _currentStats.maxHp, _currentStats.damage, _currentStats.shield, _currentStats.maxShield); } else { for (int i = 0; i < effectInfo.singleStatChanges.Count; i++) { switch (effectInfo.singleStatChanges[i].charStatChangeType) { case SpellSingleStatChangeType.None: break; case SpellSingleStatChangeType.curHPValChange: _currentStats.SetHP(_currentStats.hp + effectInfo.singleStatChanges[i].intVal); break; case SpellSingleStatChangeType.curShieldValChange: _currentStats.SetShield(_currentStats.shield + effectInfo.singleStatChanges[i].intVal); break; case SpellSingleStatChangeType.curDamageValChange: _currentStats.damage += effectInfo.singleStatChanges[i].intVal; break; case SpellSingleStatChangeType.curFlagValChange: _currentStats.flags = (BattleFlags)effectInfo.singleStatChanges[i].intVal; break; default: break; } } } DivineDebug.Log("After Update CurrentHP: " + _currentStats.hp + " Shield: " + _currentStats.shield + " Flag: " + _currentStats.flags.ToString()); ShowUpdatingStatsVisual(effectInfo); if (_curState == CharacterState.Idle && _currentStats.hp <= 0) { SetState_Dying(false); } _previousFlag = _currentStats.flags; }
public void MakeAndAddSpellEffect(BtlCtrlCharacter target, SpellEffectOnChar effectOnChar, BtlCtrlCharacter.ChangeStatInfo changeStatInfo) { var statChanges = new List <SpellSingleStatChangeInfo>(); if (Mathf.Abs(changeStatInfo.shieldChangeAmount) > 0) { statChanges.Add(new SpellSingleStatChangeInfo( SpellSingleStatChangeType.curShieldValChange, changeStatInfo.shieldChangeAmount)); } if (Mathf.Abs(changeStatInfo.hpChangeAmount) > 0) { statChanges.Add(new SpellSingleStatChangeInfo( SpellSingleStatChangeType.curHPValChange, changeStatInfo.hpChangeAmount)); } var stat = new BattleObjStats(target.hp, target.maxHp, damage, target.shield, target.maxShield); var effectInfo = new SpellEffectInfo( statChanges, target.id, effectOnChar, stat); _spellEffectInfoes.Add(effectInfo); }
//Public Methods public void Init(Party owner, CharInfo charInfo, CharacterVisual charVisual) { _extraSpellHandler = new ExtraSpellHandler(); _charVisual = charVisual; _charVisual.Event_ActionsFinished += OnCharVisualActionsFinish; _charVisual.Event_SpellCast += OnCharVisualSpellCast; _charInfo = charInfo; _currentStats = _charInfo.baseStats; DivineDebug.Log(moniker + " Created with hp: " + _currentStats.hp + " Shield: " + _currentStats.shield); SetOwnerParty(owner); _charVisual.charUI.Init( _charVisual.Tr_HUD_HelperPos, _charVisual.Tr_SelectionButton_HelperPos, _charVisual.Tr_decal_HelperPos); _charVisual.charUI.SubscribeForSelectTarget(SelectedAsTarget); _charVisual.charUI.newCharHUD.Init(_currentStats.maxHp, _currentStats.hp, _currentStats.maxShield, _currentStats.shield, _charInfo.level, side == PartySide.Player, isHero); ResetCharacterUIAndEffect(); _isActive = charInfo.enableInStart; }
public void CopyStatsTo(BattleObjStats statsObj) { statsObj.maxHp = this.maxHp ; statsObj.SetHP ( this.hp ) ; statsObj.damage = this.damage ; statsObj.SetShield ( this.shield ) ; statsObj.maxShield = this.maxShield ; }
//Base Methods public SpellEffectInfo( List <SpellSingleStatChangeInfo> statChanges, long targetCharacterID, SpellEffectOnChar effectOnChar, BattleObjStats finalCharStats) { _singleStatChanges = statChanges; _targetCharacterID = targetCharacterID; _effectOnCharacter = effectOnChar; _finalCharacterStats = finalCharStats; }
private BattleObjStats MakeBattleObject(WBattleObjStat wbattleObj) { BattleFlags flags = (BattleFlags)wbattleObj.flag; BattleObjStats battleObj = new BattleObjStats(wbattleObj.hp, wbattleObj.max_hp, wbattleObj.damage, wbattleObj.shield, wbattleObj.max_shield, flags); return(battleObj); }
private static CharInfo MakeCharatcerInfo(BtlCtrlCharacter character, bool isHero) { BattleObjStats stats = new BattleObjStats(character.hp, character.maxHp, character.spells[0].damage, character.shield, character.maxShield); var spellInfoList = new List <SpellInfo>(); for (int i = 0; i < AppearanceConfigData.instance.GetUnitMagicsCount(character.moniker); i++) { if (i >= character.spells.Count) { break; } var appearance = AppearanceConfigData.instance.GetMagicWithIndex(character.moniker, i); SpellInfo spInf = new SpellInfo( i, appearance._isInstant, appearance._dontShowToUser, appearance._needTargetToComeNear, appearance._spellName, appearance._cost, appearance._prefabName, appearance._spellType, appearance._damageType, appearance._spellImpact, null); spInf.SetSpellParams(character.spells[i].spellParams); spellInfoList.Add(spInf); } if (isHero) { HeroInfo heroInf = new HeroInfo( character.moniker, stats, spellInfoList, Dexterity.MIDDLE, 0, character.level, character.id, 0, 0, new NextUpgradeStats(), character.isActive); return(heroInf); } else { var troop = new CharInfo( character.moniker, stats, spellInfoList, Dexterity.MIDDLE, 0, character.level, character.id, 0, 0, new NextUpgradeStats(), Divine.Moniker.Unknown, character.isActive); return(troop); } }
//Private Methods private void Init(Divine.Moniker moniker, int hp, int shield, int maxHP, int maxShield, int level, Type type) { _moniker = moniker; _level = level; _type = type; _stats = new BattleObjStats(hp, maxHP, 0, shield, maxShield); _lastChangeStatInfo = new ChangeStatInfo(); }
public override bool Equals(object obj) { BattleObjStats statsObj = obj as BattleObjStats; if (statsObj == null) return false; return this.hp == statsObj.hp && this.maxHp == statsObj.maxHp && this.damage == statsObj.damage && this.shield == statsObj.shield && this.maxShield == statsObj.maxShield; }
public void DestoryCharacter() { for (int i = 0; i < spells.Count; i++) { spells[i].Event_SpellFinished -= OnSpellFinished; spells[i].Event_ActionGenerated -= OnActionGenerated; } _relatedParty = null; _spells.Clear(); _spells = null; _stats = null; }
private List <ActionData> MakeFightAction(WFightAction fightActions) { List <ActionData> actionList = new List <ActionData>(); for (int n = 0; n < fightActions.f_acts.Length; n++) { WFightActionData fightAc = fightActions.f_acts[n]; FightActionData fad = new FightActionData(); var effectsInfo = new List <SpellEffectInfo>(); AppearanceConfigData.MagicAppearanceData appearance; appearance = AppearanceConfigData.instance.GetMagicWithIndex(_battleLogic.GetCharacterWithID(fightAc.owner_id).moniker, fightAc.spell_index); fad.consumedActionPoint = fightAc.con_ap; fad.ownerID = fightAc.owner_id; //if (appearance._multiplePartDamage != null && appearance._multiplePartDamage.Count > 0) //{ // effectsInfo = multipart(appearance._multiplePartDamage, effectsInfo); //} for (int i = 0; i < fightAc.spell_effect_info.Length; i++) { BattleObjStats finalStat = MakeBattleObject(fightAc.spell_effect_info[i].final_character_stats); List <SpellSingleStatChangeInfo> statChanges = MakeSingleStatChangeList( fightAc.spell_effect_info[i].single_stat_changes); SpellEffectInfo effect = new SpellEffectInfo(statChanges, fightAc.spell_effect_info[i].target_character_id, fightAc.spell_effect_info[i].effect_on_character, finalStat); effectsInfo.Add(effect); } fad.spellInfo = new SpellInfo( fightAc.spell_index, appearance._isInstant, appearance._dontShowToUser, appearance._needTargetToComeNear, appearance._spellName, appearance._cost, appearance._prefabName, fightAc.spell_type, appearance._damageType, appearance._spellImpact, effectsInfo); fad.spellInfo.generatedActionPoint = fightAc.gen_ap; fad.spellInfo.isCritical = fightAc.is_critical; actionList.Add(fad); } return(actionList); }
private CharInfo MakeCharatcerInfo(WBattleUnitData unit, bool isHero) { BattleObjStats stats = new BattleObjStats(unit.health, unit.maxHealth, unit.attack, unit.shield, unit.maxShield); var spellInfoList = new List <SpellInfo>(); for (int i = 0; i < unit.spell.Length; i++) { var appearance = AppearanceConfigData.instance.GetMagicWithIndex(unit.moniker, unit.spell[i].index); spellInfoList.Add(new SpellInfo( i, appearance._isInstant, appearance._dontShowToUser, appearance._needTargetToComeNear, appearance._spellName, unit.spell[i].need_ap, appearance._prefabName, appearance._spellType, appearance._damageType, appearance._spellImpact, null)); string spellParams = unit.spell[i].spell_params == null ? "" : unit.spell[i].spell_params.ToString(); spellInfoList[i].SetSpellParams(spellParams); } if (isHero) { HeroInfo heroInf = new HeroInfo( unit.moniker, stats, spellInfoList, unit.dexterity, 0, unit.level, unit.id, 0, 0, new NextUpgradeStats(), unit.is_active); heroInf.SetHeroItemsForBattle(unit.items); return(heroInf); } else { var troop = new CharInfo( unit.moniker, stats, spellInfoList, unit.dexterity, 0, unit.level, unit.id, 0, 0, new NextUpgradeStats(), Divine.Moniker.Unknown, unit.is_active); return(troop); } }
public static CharInfo GetCharInfo(WUnitData troopData) { var stats = new BattleObjStats( troopData.health, troopData.max_health, troopData.attack, troopData.shield, troopData.max_shield); CharInfo chInf = new CharInfo( troopData.moniker, stats, CharInfoHelper.GetCharacterSpells(troopData.moniker), troopData.dexterity, 0, troopData.level, troopData.id, troopData.cool_down_remaining_seconds, troopData.quantity, GetNextUpgradeStats(troopData.next_upgrade_stats), troopData.ownerMoniker); chInf.SetOtherStats(troopData.critical_ratio, troopData.critical_chance, troopData.miss_chance); //chInf.SetUnlockData(troopData.used_status, troopData.unlock_league, troopData.unlock_league_step_number); chInf.SetUnlockData(WCharExistenceType.unlock, troopData.unlock_league, troopData.unlock_league_step_number); return(chInf); }
//Base Methods public CharInfo( Divine.Moniker moniker, BattleObjStats initialStats, List <SpellInfo> spells, Dexterity priority, int xp, int level, long id, int coolDownRemainingTime, int cardCount, NextUpgradeStats nextUpgradeStats, Divine.Moniker owner = Divine.Moniker.Unknown, bool isActive = true) { this.xp = xp; this.level = level; uniqueID = id; this.spells = spells; this.moniker = moniker; turnPriority = priority; baseStats = initialStats; ownerHero = owner; curCardCount = cardCount; this.nextUpgradeStats = nextUpgradeStats; SetRemainingCooldownTime(coolDownRemainingTime); enableInStart = isActive; }
public static HeroInfo GetHeroInfo(WHeroData heroData) { var stats = new BattleObjStats( heroData.health, heroData.max_health, heroData.attack, heroData.shield, heroData.max_shield); HeroInfo hInfo = new HeroInfo( heroData.moniker, stats, CharInfoHelper.GetCharacterSpells(heroData.moniker), heroData.dexterity, 0, heroData.level, heroData.id, 0, heroData.quantity, GetNextUpgradeStats(heroData.next_upgrade_stats)); hInfo.SetOtherStats(heroData.critical_ratio, heroData.critical_chance, heroData.miss_chance); hInfo.SetChakra(heroData.chakra, GetCharacterSpells(heroData.chakra.chakra_moniker)); hInfo.SetIsSelectedHero(heroData.selected_hero); hInfo.SetHeroItems(heroData.items); return(hInfo); }
public void SetBaseStats(int curHP, int maxHP, int damage, int curShield, int MaxShield) { baseStats = new BattleObjStats(curHP, maxHP, damage, curShield, MaxShield); }