public RPGEffect(DurationType t, EffectRange r, EffectTargetBuff buff, EffectTargetAttack attack, bool isABuff, EffectTrigger trigger, int Distance, int Radius, TimeSpan Duration, int MinPower, int MaxPower, EffectPowerType powerType, bool ReverseWhenExpires) { this.durationType = t; this.range = r; this.TargetBuff = buff; this.TargetAttack = attack; this.effectIsABuff = isABuff; this.status = EffectStatus.Ready; this.trigger = trigger; this.repeatCount = 0; this.distance = Distance; this.radius = Radius; this.Duration = Duration; this.minPower = MinPower; this.maxPower = MaxPower; this.powerType = powerType; this.m_Power = new RPGCalc().RollDmg(minPower, maxPower); this.m_shouldReverse = ReverseWhenExpires; }
public void SetData(BattleUnitData bud) { mID = bud.mID; mType = bud.mType; mHp = mMaxHp = bud.mMaxHp; mEn = mMaxEn = bud.mMaxEn; mAmmo = mMaxAmmo = bud.mMaxAmmo; mAtk = bud.mAtk; mAtkType = bud.mAtkType; mAtkInterval = bud.mAtkInterval; mAtkRange = bud.mAtkRange; mDef = bud.mDef; mDefType = bud.mDefType; mRps = bud.mRps; mHealPs = bud.mHealPs; mHealType = bud.mHealType; mHealRange = bud.mHealRange; mEnCostPs = bud.mEnCostPs; mAmmoCostPs = bud.mAmmoCostPs; mPlayerForce = bud.mPlayerForce; mMoveInterval = bud.mMoveInterval; mSpreadFactor = bud.mSpreadFactor; ReCountBE(); }
public RPGEffect(RPGEffect copy) { range = copy.range; durationType = copy.durationType; targetBuff = copy.targetBuff; targetAttack = copy.targetAttack; effectIsABuff = copy.effectIsABuff; trigger = copy.trigger; status = copy.status; location = copy.location; sourceObject = copy.sourceObject; targetObject = copy.targetObject; distance = copy.distance; radius = copy.radius; durationValue = copy.durationValue; minPower = copy.minPower; maxPower = copy.maxPower; m_Power = copy.Power; lastStart = copy.lastStart; lastPause = copy.lastPause; durationRemaining = copy.durationRemaining; repeatCount = copy.repeatCount; m_repeatDelay = copy.m_repeatDelay; m_lastRepeat = copy.m_lastRepeat; m_shouldReverse = copy.m_shouldReverse; powerType = copy.PowerType; }
static Ranges() { Personal = new EffectRange(WizardMonks.Ranges.Personal, 0); Touch = new EffectRange(WizardMonks.Ranges.Touch, 1); Eye = new EffectRange(WizardMonks.Ranges.Eye, 1); Voice = new EffectRange(WizardMonks.Ranges.Voice, 2); Sight = new EffectRange(WizardMonks.Ranges.Sight, 3); Arcane = new EffectRange(WizardMonks.Ranges.Arcane, 4); }
public static RPGEffect CreateRandomSpellEffect() { #region Setup Vars RPGCalc calc = new RPGCalc(); DurationType t = DurationType.Permanent; TimeSpan duration = new TimeSpan(0, 0, 0); EffectRange r = (EffectRange)calc.GetRandomEnum(typeof(EffectRange)); EffectTrigger trigger = EffectTrigger.Immediately; EffectTargetBuff targetBuff = EffectTargetBuff.RestoreHP; EffectTargetAttack targetAttack = EffectTargetAttack.DoMagicalDamage; bool isBuff = true; int dist = 0; int radius = 0; int minPower = 0; int maxPower = 0; bool reverse = true; #endregion #region Buff or Attack // 50/50 percent of offensive for completely random if (calc.Roll(2) == 1) { isBuff = true; } else { isBuff = false; } #endregion #region Range and Distance // check to avoid attacking self while (!isBuff && r == EffectRange.Self) { r = (EffectRange)calc.GetRandomEnum(typeof(EffectRange)); } // roll for distance depending on range dist = 0; switch (r) { case (EffectRange.Self): { break; } case (EffectRange.Touch): { dist = RPGCalc.DEFAULT_TOUCH_RANGE; break; } case (EffectRange.Target): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.Area): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.TargetArea): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } } // end switch #endregion #region Attack and Buff Effects // target buff effect targetBuff = (EffectTargetBuff)calc.GetRandomEnum(typeof(EffectTargetBuff)); // target attack effect // 20% chance of being completely random if (calc.Roll(10) >= 8) { targetAttack = (EffectTargetAttack)calc.GetRandomEnum(typeof(EffectTargetAttack)); } else // 80% chance of being magical damage { targetAttack = EffectTargetAttack.DoMagicalDamage; } #endregion #region Set Duration Types based on effect // isBuff and is restore, or isNotBuff and is Dmg if (isBuff) { // then we want to reverse all but the restore if (targetBuff == EffectTargetBuff.RestoreHP || targetBuff == EffectTargetBuff.RestoreMP) { reverse = false; t = DurationType.Permanent; } else { reverse = true; duration = calc.RollRandomEffectDuration(0, 0, 0, 60); t = DurationType.ForTime; } } else // it's an attack { // check to avoid reverse on dmg spells if (targetAttack == EffectTargetAttack.DoMagicalDamage || targetAttack == EffectTargetAttack.DoPhysicalDamage) { reverse = false; t = DurationType.Permanent; } else { reverse = true; duration = calc.RollRandomEffectDuration(0, 0, 0, 60); t = DurationType.ForTime; } } #endregion #region Power // roll for min/max power - start with generic minPower = calc.Roll(10); maxPower = minPower + calc.Roll(10); // NOTE: dmg depends on duration and duration type - if long, then small dmg... #endregion #region Trigger // trigger - spell will cause effect immediately. trigger = EffectTrigger.Immediately; #endregion RPGEffect e = new RPGEffect(t, r, targetBuff, targetAttack, isBuff, trigger, dist, radius, duration, minPower, maxPower, RPGEffect.EffectPowerType.StaticAmount, reverse); return(e); }
public static RPGEffect CreateRandomPotionEffect() { RPGCalc calc = new RPGCalc(); DurationType t = DurationType.ForTime; TimeSpan duration = new TimeSpan(0, 0, 0); EffectRange r = EffectRange.Touch; EffectTrigger trigger = EffectTrigger.Immediately; EffectTargetBuff targetBuff = EffectTargetBuff.RestoreHP; EffectTargetAttack targetAttack = EffectTargetAttack.DoPhysicalDamage; bool isBuff = true; int dist = 0; int radius = 0; int minPower = 0; int maxPower = 0; bool reverse = true; // roll for target targetBuff = (EffectTargetBuff)calc.GetRandomEnum(typeof(EffectTargetBuff)); targetAttack = (EffectTargetAttack)calc.GetRandomEnum(typeof(EffectTargetAttack)); if (targetBuff == EffectTargetBuff.RestoreHP || targetBuff == EffectTargetBuff.RestoreMP) { reverse = false; } else { duration = calc.RollRandomEffectDuration(); } // roll for range while (r == EffectRange.Touch) { r = (EffectRange)calc.GetRandomEnum(typeof(EffectRange)); } // roll for distance depending on range dist = 0; switch (r) { case (EffectRange.Self): { break; } case (EffectRange.Touch): { dist = RPGCalc.DEFAULT_TOUCH_RANGE; break; } case (EffectRange.Target): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.Area): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.TargetArea): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } } // end switch // roll for min/max power minPower = calc.Roll(10); maxPower = minPower + calc.Roll(10); // trigger - potion will cause effect to be used immediately. trigger = EffectTrigger.Immediately; RPGEffect e = new RPGEffect(t, r, targetBuff, targetAttack, isBuff, trigger, dist, radius, duration, minPower, maxPower, RPGEffect.EffectPowerType.StaticAmount, reverse); return(e); }
public static RPGEffect CreateRandomEffect() { RPGCalc calc = new RPGCalc(); DurationType t = DurationType.ForTime; TimeSpan duration = new TimeSpan(0, 0, 0); EffectRange r = EffectRange.Target; EffectTrigger trigger = EffectTrigger.Immediately; EffectTargetBuff targetBuff; EffectTargetAttack targetAttack; bool isBuff = true; bool reverse = true; int dist = 0; int radius = 0; int minPower = 0; int maxPower = 0; // roll for type t = (DurationType)calc.GetRandomEnum(typeof(DurationType)); duration = new TimeSpan(0); if (t == DurationType.ForTime) { duration = calc.RollRandomEffectDuration(); // ticks (I think) } // roll for range r = (EffectRange)calc.GetRandomEnum(typeof(EffectRange)); // roll for distance depending on range dist = 0; switch (r) { case (EffectRange.Self): { break; } case (EffectRange.Touch): { dist = RPGCalc.DEFAULT_TOUCH_RANGE; break; } case (EffectRange.Target): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.Area): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } case (EffectRange.TargetArea): { dist = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); radius = calc.Roll(RPGCalc.DEFAULT_LOS_RANGE); break; } } // end switch // roll for target targetBuff = (EffectTargetBuff)calc.GetRandomEnum(typeof(EffectTargetBuff)); targetAttack = (EffectTargetAttack)calc.GetRandomEnum(typeof(EffectTargetAttack)); isBuff = (calc.Roll(2) == 1); // roll for min/max power minPower = calc.Roll(10); maxPower = minPower + calc.Roll(10); // roll for trigger trigger = (EffectTrigger)calc.GetRandomEnum(typeof(EffectTrigger)); RPGEffect e = new RPGEffect(t, r, targetBuff, targetAttack, isBuff, trigger, dist, radius, duration, minPower, maxPower, RPGEffect.EffectPowerType.StaticAmount, reverse); return(e); }