private bool attachCond(WeatherData.eCondAttachType cond_at_type, Unit target, RandXorshift rand = null) { bool flag = false; using (List <CondEffect> .Enumerator enumerator = this.mCondEffectLists.GetEnumerator()) { while (enumerator.MoveNext()) { CondEffect current = enumerator.Current; if (current != null && current.param != null && current.param.conditions != null) { switch (cond_at_type) { case WeatherData.eCondAttachType.PASSIVE: if (current.param.chk_timing == EffectCheckTimings.Eternal) { break; } continue; case WeatherData.eCondAttachType.TURN: if (current.param.chk_timing != EffectCheckTimings.Eternal) { break; } continue; } if (current.CheckEnableCondTarget(target)) { ConditionEffectTypes type = current.param.type; switch (type) { case ConditionEffectTypes.CureCondition: for (int index = 0; index < current.param.conditions.Length; ++index) { EUnitCondition condition = current.param.conditions[index]; this.cureCond(target, condition); } break; case ConditionEffectTypes.FailCondition: if ((int)current.value != 0) { EnchantParam enchantResist = target.CurrentStatus.enchant_resist; for (int index = 0; index < current.param.conditions.Length; ++index) { EUnitCondition condition = current.param.conditions[index]; if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)current.value, (int)enchantResist[condition], condition, rand)) { this.failCond(target, current, type, condition); } } break; } break; case ConditionEffectTypes.ForcedFailCondition: for (int index = 0; index < current.param.conditions.Length; ++index) { EUnitCondition condition = current.param.conditions[index]; this.failCond(target, current, type, condition); } break; case ConditionEffectTypes.RandomFailCondition: if ((int)current.value != 0) { EnchantParam enchantResist = target.CurrentStatus.enchant_resist; int index = rand == null ? 0 : (int)((long)rand.Get() % (long)current.param.conditions.Length); EUnitCondition condition = current.param.conditions[index]; if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)current.value, (int)enchantResist[condition], condition, rand)) { this.failCond(target, current, type, condition); break; } break; } break; case ConditionEffectTypes.DisableCondition: for (int index = 0; index < current.param.conditions.Length; ++index) { CondAttachment condAttachment = this.createCondAttachment(target, current, type, current.param.conditions[index]); CondAttachment sameCondAttachment = this.getSameCondAttachment(target, condAttachment); if (sameCondAttachment != null) { sameCondAttachment.turn = condAttachment.turn; } else { target.SetCondAttachment(condAttachment); } } break; } flag = true; } } } } return(flag); }
private static BattleSuspend.Data makeSaveData() { SceneBattle instance = SceneBattle.Instance; if (!UnityEngine.Object.op_Implicit((UnityEngine.Object)instance)) { return((BattleSuspend.Data)null); } BattleCore battle = instance.Battle; if (battle == null) { return((BattleSuspend.Data)null); } BattleSuspend.Data data = new BattleSuspend.Data(); BattleSuspend.Data.Header hdr = data.hdr; hdr.apv = Application.get_version(); hdr.arv = AssetManager.AssetRevision; hdr.qid = battle.QuestID; hdr.bid = battle.BtlID; hdr.cat = GameUtility.Config_AutoMode_Treasure.Value; hdr.cad = GameUtility.Config_AutoMode_DisableSkill.Value; data.uil.Clear(); using (List <Unit> .Enumerator enumerator1 = battle.AllUnits.GetEnumerator()) { while (enumerator1.MoveNext()) { Unit current1 = enumerator1.Current; if (current1 != null) { BattleSuspend.Data.UnitInfo unitInfo = new BattleSuspend.Data.UnitInfo(); unitInfo.nam = current1.UnitName; unitInfo.nhp = (int)current1.CurrentStatus.param.hp; unitInfo.chp = current1.UnitChangedHp; unitInfo.gem = current1.Gems; unitInfo.ugx = current1.x; unitInfo.ugy = current1.y; unitInfo.dir = (int)current1.Direction; unitInfo.ufg = current1.UnitFlag; unitInfo.isb = current1.IsSub; unitInfo.crt = (int)current1.ChargeTime; unitInfo.tgi = BattleSuspend.GetIdxFromAllUnits(battle, current1.Target); unitInfo.rti = BattleSuspend.GetIdxFromAllUnits(battle, current1.RageTarget); unitInfo.cti = -1; if (current1.CastSkill != null) { unitInfo.csi = current1.CastSkill.SkillParam.iname; unitInfo.ctm = (int)current1.CastTime; unitInfo.cid = (int)current1.CastIndex; if (current1.CastSkillGridMap != null) { unitInfo.cgw = current1.CastSkillGridMap.w; unitInfo.cgh = current1.CastSkillGridMap.h; if (current1.CastSkillGridMap.data != null) { unitInfo.cgm = new int[current1.CastSkillGridMap.data.Length]; for (int index = 0; index < current1.CastSkillGridMap.data.Length; ++index) { unitInfo.cgm[index] = !current1.CastSkillGridMap.data[index] ? 0 : 1; } } } unitInfo.ctx = current1.GridTarget == null ? -1 : current1.GridTarget.x; unitInfo.cty = current1.GridTarget == null ? -1 : current1.GridTarget.y; unitInfo.cti = BattleSuspend.GetIdxFromAllUnits(battle, current1.UnitTarget); } unitInfo.dct = current1.DeathCount; unitInfo.ajw = current1.AutoJewel; unitInfo.wtt = current1.WaitClock; unitInfo.mvt = current1.WaitMoveTurn; unitInfo.acc = current1.ActionCount; unitInfo.tuc = current1.TurnCount; unitInfo.trc = current1.EventTrigger == null ? 0 : current1.EventTrigger.Count; unitInfo.klc = current1.KillCount; if (current1.EntryTriggers != null) { unitInfo.etr = new int[current1.EntryTriggers.Count]; for (int index = 0; index < current1.EntryTriggers.Count; ++index) { unitInfo.etr[index] = !current1.EntryTriggers[index].on ? 0 : 1; } } unitInfo.aid = (int)current1.AIActionIndex; unitInfo.atu = (int)current1.AIActionTurnCount; unitInfo.apt = (int)current1.AIPatrolIndex; unitInfo.boi = current1.CreateBreakObjId; unitInfo.boc = current1.CreateBreakObjClock; unitInfo.tid = current1.TeamId; unitInfo.fst = (int)current1.FriendStates; unitInfo.acl.Clear(); for (int index1 = 0; index1 < current1.AbilityChangeLists.Count; ++index1) { Unit.AbilityChange abilityChangeList = current1.AbilityChangeLists[index1]; if (abilityChangeList != null && abilityChangeList.mDataLists.Count != 0) { BattleSuspend.Data.UnitInfo.AbilChg abilChg = new BattleSuspend.Data.UnitInfo.AbilChg(); for (int index2 = 0; index2 < abilityChangeList.mDataLists.Count; ++index2) { Unit.AbilityChange.Data mDataList = abilityChangeList.mDataLists[index2]; abilChg.acd.Add(new BattleSuspend.Data.UnitInfo.AbilChg.Data() { fid = mDataList.mFromAp.iname, tid = mDataList.mToAp.iname, tur = mDataList.mTurn, irs = !mDataList.mIsReset ? 0 : 1, exp = mDataList.mExp, iif = !mDataList.mIsInfinite ? 0 : 1 }); } unitInfo.acl.Add(abilChg); } } unitInfo.aal.Clear(); for (int index = 0; index < current1.AddedAbilitys.Count; ++index) { AbilityData addedAbility = current1.AddedAbilitys[index]; if (addedAbility != null) { unitInfo.aal.Add(new BattleSuspend.Data.UnitInfo.AddedAbil() { aid = addedAbility.AbilityID, exp = addedAbility.Exp }); } } unitInfo.sul.Clear(); using (Dictionary <SkillData, OInt> .Enumerator enumerator2 = current1.GetSkillUseCount().GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair <SkillData, OInt> current2 = enumerator2.Current; unitInfo.sul.Add(new BattleSuspend.Data.UnitInfo.SkillUse() { sid = current2.Key.SkillParam.iname, ctr = (int)current2.Value }); } } unitInfo.bfl.Clear(); using (List <BuffAttachment> .Enumerator enumerator2 = current1.BuffAttachments.GetEnumerator()) { while (enumerator2.MoveNext()) { BuffAttachment current2 = enumerator2.Current; if ((!(bool)current2.IsPassive || current2.Param != null && (bool)current2.Param.mIsUpBuff || current2.skill != null && !current2.skill.IsSubActuate()) && current2.CheckTiming != EffectCheckTimings.Moment) { BattleSuspend.Data.UnitInfo.Buff buff = new BattleSuspend.Data.UnitInfo.Buff(); buff.sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname; buff.stg = (int)current2.skilltarget; buff.tur = (int)current2.turn; buff.uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user); buff.cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget); buff.tim = (int)current2.CheckTiming; buff.ipa = (bool)current2.IsPassive; buff.ucd = (int)current2.UseCondition; buff.btp = (int)current2.BuffType; buff.vtp = !current2.IsNegativeValueIsBuff ? 0 : 1; buff.ctp = (int)current2.CalcType; buff.lid = current2.LinkageID; buff.ubc = (int)current2.UpBuffCount; buff.atl.Clear(); if (current2.AagTargetLists != null) { for (int index = 0; index < current2.AagTargetLists.Count; ++index) { int idxFromAllUnits = BattleSuspend.GetIdxFromAllUnits(battle, current2.AagTargetLists[index]); if (idxFromAllUnits >= 0) { buff.atl.Add(idxFromAllUnits); } } } unitInfo.bfl.Add(buff); } } } unitInfo.cdl.Clear(); using (List <CondAttachment> .Enumerator enumerator2 = current1.CondAttachments.GetEnumerator()) { while (enumerator2.MoveNext()) { CondAttachment current2 = enumerator2.Current; if (!(bool)current2.IsPassive || current2.skill != null && !current2.skill.IsSubActuate()) { unitInfo.cdl.Add(new BattleSuspend.Data.UnitInfo.Cond() { sid = current2.skill == null ? (string)null : current2.skill.SkillParam.iname, stg = (int)current2.skilltarget, cid = current2.CondId, tur = (int)current2.turn, uni = BattleSuspend.GetIdxFromAllUnits(battle, current2.user), cui = BattleSuspend.GetIdxFromAllUnits(battle, current2.CheckTarget), tim = (int)current2.CheckTiming, ipa = (bool)current2.IsPassive, ucd = (int)current2.UseCondition, cdt = (int)current2.CondType, cnd = (int)current2.Condition, icu = current2.IsCurse, lid = current2.LinkageID }); } } } unitInfo.shl.Clear(); using (List <Unit.UnitShield> .Enumerator enumerator2 = current1.Shields.GetEnumerator()) { while (enumerator2.MoveNext()) { Unit.UnitShield current2 = enumerator2.Current; unitInfo.shl.Add(new BattleSuspend.Data.UnitInfo.Shield() { inm = current2.skill_param.iname, nhp = (int)current2.hp, mhp = (int)current2.hpMax, ntu = (int)current2.turn, mtu = (int)current2.turnMax, drt = (int)current2.damage_rate, dvl = (int)current2.damage_value }); } } unitInfo.hpi.Clear(); using (List <SkillData> .Enumerator enumerator2 = current1.JudgeHpLists.GetEnumerator()) { while (enumerator2.MoveNext()) { SkillData current2 = enumerator2.Current; unitInfo.hpi.Add(current2.SkillID); } } unitInfo.mhl.Clear(); using (List <Unit.UnitMhmDamage> .Enumerator enumerator2 = current1.MhmDamageLists.GetEnumerator()) { while (enumerator2.MoveNext()) { Unit.UnitMhmDamage current2 = enumerator2.Current; unitInfo.mhl.Add(new BattleSuspend.Data.UnitInfo.MhmDmg() { typ = (int)current2.mType, dmg = (int)current2.mDamage }); } } data.uil.Add(unitInfo); } } } data.itl.Clear(); using (Dictionary <OString, OInt> .Enumerator enumerator = battle.GetQuestRecord().used_items.GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <OString, OInt> current = enumerator.Current; data.itl.Add(new BattleSuspend.Data.UsedItem() { iti = (string)current.Key, num = (int)current.Value }); } } data.trl.Clear(); using (List <TrickData> .Enumerator enumerator = TrickData.GetEffectAll().GetEnumerator()) { while (enumerator.MoveNext()) { TrickData current = enumerator.Current; data.trl.Add(new BattleSuspend.Data.TrickInfo() { tid = current.TrickParam.Iname, val = (bool)current.Valid, cun = BattleSuspend.GetIdxFromAllUnits(battle, current.CreateUnit), rnk = (int)current.Rank, rcp = (int)current.RankCap, grx = (int)current.GridX, gry = (int)current.GridY, rac = (int)current.RestActionCount, ccl = (int)current.CreateClock, tag = current.Tag }); } } data.sel.Clear(); using (Dictionary <string, BattleCore.SkillExecLog> .KeyCollection.Enumerator enumerator = battle.SkillExecLogs.Keys.GetEnumerator()) { while (enumerator.MoveNext()) { string current = enumerator.Current; data.sel.Add(new BattleSuspend.Data.SkillExecLogInfo() { inm = current, ucnt = battle.SkillExecLogs[current].use_count, kcnt = battle.SkillExecLogs[current].kill_count }); } } BattleSuspend.Data.Variables var = data.var; var.wtc = battle.WinTriggerCount; var.ltc = battle.LoseTriggerCount; var.act = battle.ActionCount; var.kls = battle.Killstreak; var.mks = battle.MaxKillstreak; var.thl = battle.TotalHeal; var.tdt = battle.TotalDamagesTaken; var.tdm = battle.TotalDamages; var.nui = battle.NumUsedItems; var.nus = battle.NumUsedSkills; var.ctm = battle.ClockTime; var.ctt = battle.ClockTimeTotal; var.coc = battle.ContinueCount; var.fns = battle.FinisherIname; var.glc = instance.GoldCount; var.trc = instance.TreasureCount; var.rsd = battle.Seed; uint[] seed = battle.Rand.GetSeed(); if (seed != null) { var.ris = new uint[seed.Length]; seed.CopyTo((Array)var.ris, 0); } var.gsl.Clear(); using (List <GimmickEvent> .Enumerator enumerator = battle.GimmickEventList.GetEnumerator()) { while (enumerator.MoveNext()) { GimmickEvent current = enumerator.Current; var.gsl.Add(new BattleSuspend.Data.Variables.GimmickEvent() { ctr = current.count, cmp = !current.IsCompleted ? 0 : 1 }); } } var.ssl.Clear(); if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance.EventScript, (UnityEngine.Object)null) && instance.EventScript.mSequences != null) { foreach (EventScript.ScriptSequence mSequence in instance.EventScript.mSequences) { var.ssl.Add(new BattleSuspend.Data.Variables.ScriptEvent() { trg = mSequence.Triggered }); } } var.tkk = battle.TargetKillstreak.Keys.ToArray <string>(); var.tkv = battle.TargetKillstreak.Values.ToArray <int>(); var.mtk = battle.MaxTargetKillstreak.Keys.ToArray <string>(); var.mtv = battle.MaxTargetKillstreak.Values.ToArray <int>(); var.pbm = battle.PlayByManually; var.uam = battle.IsUseAutoPlayMode; var.wti.wid = (string)null; WeatherData currentWeatherData = WeatherData.CurrentWeatherData; if (currentWeatherData != null) { var.wti.wid = currentWeatherData.WeatherParam.Iname; var.wti.mun = BattleSuspend.GetIdxFromAllUnits(battle, currentWeatherData.ModifyUnit); var.wti.rnk = (int)currentWeatherData.Rank; var.wti.rcp = (int)currentWeatherData.RankCap; var.wti.ccl = (int)currentWeatherData.ChangeClock; } var.ctd = battle.CurrentTeamId; var.mtd = battle.MaxTeamId; var.pbd = instance.EventPlayBgmID; data.ivl = true; return(data); }
public bool IsSame(CondAttachment dsc, bool is_ignore_timing = false) { return(dsc != null && this.skill != null && (dsc.skill != null && this.skill.SkillID == dsc.skill.SkillID) && ((bool)this.IsPassive == (bool)dsc.IsPassive && this.CondType == dsc.CondType && this.Condition == dsc.Condition) && ((is_ignore_timing || this.CheckTiming == dsc.CheckTiming) && this.UseCondition == dsc.UseCondition)); }