public bool BuffSkill(ESkillTiming timing, EElement element, BaseStatus buff, BaseStatus buff_negative, BaseStatus buff_scale, BaseStatus debuff, BaseStatus debuff_negative, BaseStatus debuff_scale, RandXorshift rand = null, SkillEffectTargets buff_target = SkillEffectTargets.Target, bool is_resume = false, List <BuffEffect.BuffValues> list = null) { if (this.Timing != timing) { return(false); } BuffEffect buffEffect = this.GetBuffEffect(buff_target); if (buffEffect == null) { return(false); } if (!is_resume) { int rate = (int)buffEffect.param.rate; if (rate > 0 && rate < 100) { DebugUtility.Assert(rand != null, "発動確率が設定されているスキルを正規タイミングで発動させたにも関わらず乱数生成器の設定がされていない"); if ((int)(rand.Get() % 100U) > rate) { return(false); } } } if (list == null) { if (buff != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, true, false, SkillParamCalcTypes.Add, buff, (List <BuffEffect.BuffValues>)null); } if (buff_negative != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, true, true, SkillParamCalcTypes.Add, buff_negative, (List <BuffEffect.BuffValues>)null); } if (buff_scale != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, buff_scale, (List <BuffEffect.BuffValues>)null); } if (debuff != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, true, false, SkillParamCalcTypes.Add, debuff, (List <BuffEffect.BuffValues>)null); } if (debuff_negative != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, true, true, SkillParamCalcTypes.Add, debuff_negative, (List <BuffEffect.BuffValues>)null); } if (debuff_scale != null) { this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, debuff_scale, (List <BuffEffect.BuffValues>)null); } } else { this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Add, (BaseStatus)null, list); this.InternalBuffSkill(buffEffect, element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, (BaseStatus)null, list); this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Add, (BaseStatus)null, list); this.InternalBuffSkill(buffEffect, element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, (BaseStatus)null, list); } return(true); }
public string GetChangeWeather(RandXorshift rand = null) { if (this.mChangeWeatherIdLists.Count == 0) { return((string)null); } int index1 = 0; if (rand != null) { int num1 = (int)(rand.Get() % 100U); int num2 = 0; for (int index2 = 0; index2 < this.mChangeWeatherRateLists.Count; ++index2) { num2 += this.mChangeWeatherRateLists[index2]; if (num1 < num2) { index1 = index2; break; } } } if (index1 >= this.mChangeWeatherIdLists.Count) { index1 = 0; } return(this.mChangeWeatherIdLists[index1]); }
private bool actionBuff(Unit target, EffectCheckTimings chk_timing, RandXorshift rand = null) { if (this.mBuffEffect == null || target == null || !this.mBuffEffect.CheckEnableBuffTarget(target)) { return(false); } if (rand != null) { int rate = (int)this.mBuffEffect.param.rate; if (0 < rate && rate < 100 && (int)(rand.Get() % 100U) > rate) { return(true); } } BaseStatus status1 = new BaseStatus(); BaseStatus status2 = new BaseStatus(); BaseStatus status3 = new BaseStatus(); BaseStatus status4 = new BaseStatus(); BaseStatus status5 = new BaseStatus(); BaseStatus status6 = new BaseStatus(); this.mBuffEffect.CalcBuffStatus(ref status1, target.Element, BuffTypes.Buff, true, false, SkillParamCalcTypes.Add, 0); this.mBuffEffect.CalcBuffStatus(ref status2, target.Element, BuffTypes.Buff, true, true, SkillParamCalcTypes.Add, 0); this.mBuffEffect.CalcBuffStatus(ref status3, target.Element, BuffTypes.Buff, false, false, SkillParamCalcTypes.Scale, 0); this.mBuffEffect.CalcBuffStatus(ref status4, target.Element, BuffTypes.Debuff, true, false, SkillParamCalcTypes.Add, 0); this.mBuffEffect.CalcBuffStatus(ref status5, target.Element, BuffTypes.Debuff, true, true, SkillParamCalcTypes.Add, 0); this.mBuffEffect.CalcBuffStatus(ref status6, target.Element, BuffTypes.Debuff, false, false, SkillParamCalcTypes.Scale, 0); if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, false)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, false, SkillParamCalcTypes.Add, status1, chk_timing); target.SetBuffAttachment(buffAttachment, false); } if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Add, true)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, true, SkillParamCalcTypes.Add, status2, chk_timing); target.SetBuffAttachment(buffAttachment, false); } if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Buff, SkillParamCalcTypes.Scale)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Buff, false, SkillParamCalcTypes.Scale, status3, chk_timing); target.SetBuffAttachment(buffAttachment, false); } if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, false)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, false, SkillParamCalcTypes.Add, status4, chk_timing); target.SetBuffAttachment(buffAttachment, false); } if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Add, true)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, true, SkillParamCalcTypes.Add, status5, chk_timing); target.SetBuffAttachment(buffAttachment, false); } if (this.mBuffEffect.CheckBuffCalcType(BuffTypes.Debuff, SkillParamCalcTypes.Scale)) { BuffAttachment buffAttachment = this.createBuffAttachment(target, BuffTypes.Debuff, false, SkillParamCalcTypes.Scale, status6, chk_timing); target.SetBuffAttachment(buffAttachment, false); } return(true); }
private bool checkKnockBack(Unit target, RandXorshift rand) { if (target == null || rand == null || target.IsDisableUnitCondition(EUnitCondition.DisableKnockback)) { return(false); } int num = (int)this.mTrickParam.KnockBackRate - (int)target.CurrentStatus.enchant_resist[EnchantTypes.Knockback]; return(num > 0 && (num >= 100 || (int)(rand.Get() % 100U) < num)); }
public int GetNextChangeClock(int now_clock, RandXorshift rand = null) { if (this.mChangeClockMin == 0 || this.mChangeClockMax == 0) { return(0); } int mChangeClockMin = this.mChangeClockMin; int num = this.mChangeClockMax - this.mChangeClockMin + 1; if (num > 1 && rand != null) { mChangeClockMin += (int)((long)rand.Get() % (long)num); } return(now_clock + mChangeClockMin); }
private bool checkFailCond(Unit target, int val, int resist, EUnitCondition condition, RandXorshift rand) { if (rand == null || val <= 0) { return(false); } int num1 = val - resist; if (num1 <= 0) { return(false); } int num2 = (int)(rand.Get() % 100U); return(num1 > num2); }
private bool actionCond(Unit target, RandXorshift rand, LogMapTrick.TargetInfo log_mt_ti) { CondEffect mCondEffect = this.mCondEffect; if (rand == null || mCondEffect == null || (mCondEffect.param == null || mCondEffect.param.conditions == null)) { return(false); } ConditionEffectTypes conditionEffectTypes = ConditionEffectTypes.None; if (!mCondEffect.CheckEnableCondTarget(target)) { return(true); } if (mCondEffect.param.type != ConditionEffectTypes.None && mCondEffect.param.conditions != null) { int rate = (int)mCondEffect.rate; if (0 < rate && rate < 100 && (int)(rand.Get() % 100U) > rate) { return(true); } conditionEffectTypes = mCondEffect.param.type; } switch (conditionEffectTypes) { case ConditionEffectTypes.CureCondition: for (int index = 0; index < mCondEffect.param.conditions.Length; ++index) { EUnitCondition condition = mCondEffect.param.conditions[index]; this.cureCond(target, condition, log_mt_ti); } break; case ConditionEffectTypes.FailCondition: if ((int)mCondEffect.value != 0) { EnchantParam enchantResist = target.CurrentStatus.enchant_resist; for (int index = 0; index < mCondEffect.param.conditions.Length; ++index) { EUnitCondition condition = mCondEffect.param.conditions[index]; if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)mCondEffect.value, (int)enchantResist[condition], condition, rand)) { this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti); } } break; } break; case ConditionEffectTypes.ForcedFailCondition: for (int index = 0; index < mCondEffect.param.conditions.Length; ++index) { EUnitCondition condition = mCondEffect.param.conditions[index]; this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti); } break; case ConditionEffectTypes.RandomFailCondition: if ((int)mCondEffect.value != 0) { EnchantParam enchantResist = target.CurrentStatus.enchant_resist; int index = (int)((long)rand.Get() % (long)mCondEffect.param.conditions.Length); EUnitCondition condition = mCondEffect.param.conditions[index]; if (!target.IsDisableUnitCondition(condition) && this.checkFailCond(target, (int)mCondEffect.value, (int)enchantResist[condition], condition, rand)) { this.failCond(target, mCondEffect, conditionEffectTypes, condition, log_mt_ti); break; } break; } break; case ConditionEffectTypes.DisableCondition: for (int index = 0; index < mCondEffect.param.conditions.Length; ++index) { CondAttachment condAttachment = this.createCondAttachment(target, mCondEffect, conditionEffectTypes, mCondEffect.param.conditions[index]); target.SetCondAttachment(condAttachment); } break; } return(true); }
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); }