public static Actor Build(Characters cardChoice, short cardId) { // gathering character information var associations = CharacterLegend[cardChoice]; var originStats = OriginStats[associations.origin]; var classStats = ClassStats[associations.@class]; var rarityStats = RarityStats[associations.rarity]; Attribute health = new Attribute(); Attribute defense = new Attribute(); Attribute attack = new Attribute(); Attribute speed = new Attribute(); Attribute precision = new Attribute(); Attribute manaCost = new Attribute(); // attaching stats string name = associations.name; string origin = originStats.origin; string @class = classStats.@class; string rarity = rarityStats.rarity; health.BaseValue = (short)(originStats.health + classStats.health + rarityStats.health); health.CurrentValue = (short)(originStats.health + classStats.health + rarityStats.health); defense.BaseValue = (short)(originStats.defense + classStats.defense + rarityStats.defense); defense.CurrentValue = (short)(originStats.defense + classStats.defense + rarityStats.defense); attack.BaseValue = (short)(originStats.attack + classStats.attack + rarityStats.attack); attack.CurrentValue = (short)(originStats.attack + classStats.attack + rarityStats.attack); speed.BaseValue = (short)(originStats.speed + classStats.speed + rarityStats.speed); speed.CurrentValue = (short)(originStats.speed + classStats.speed + rarityStats.speed); precision.BaseValue = (short)(originStats.precision + classStats.precision + rarityStats.precision); precision.CurrentValue = (short)(originStats.precision + classStats.precision + rarityStats.precision); manaCost.BaseValue = rarityStats.manaCost; manaCost.CurrentValue = rarityStats.manaCost; short characterId = (short)cardChoice; // attaching effects List <Effect> actorEffects = new List <Effect>(); var characterEffectDetailsList = CharacterEffects[cardChoice]; foreach (var effectDetailsReference in characterEffectDetailsList) { var effectDetails = Effects[effectDetailsReference]; Targeter targeter = effectDetails.targeter; AppliedEffect appliedEffect = effectDetails.appliedEffect; string animation = effectDetails.animation; Effect effect = new Effect(targeter, appliedEffect, animation); actorEffects.Add(effect); } Effect[] effectArray = actorEffects.ToArray(); ActorAction2 actorAction = new ActorAction2(effectArray); Actor actor = new Actor(cardId, origin, @class, name, health, defense, attack, speed, precision, manaCost, rarity, actorAction, characterId); return(actor); }
public virtual void StackAppliedEffect(ref AppliedEffect applied) { if (applied.durationLeft != -1) { if (duration == -1) { applied.durationLeft = -1; } else if (applied.durationLeft < duration) { applied.durationLeft = duration; } } }
static float GetEffectValueMult(AppliedEffect effect, float frameStart, float frameEnd) { if (effect.endTime < frameStart || effect.startTime > frameEnd) { return(1f); } float power = effect.amount; if (effect.endTime < frameEnd || effect.startTime > frameStart) { float start = Mathf.Max(frameStart, effect.startTime); float end = Mathf.Min(frameEnd, effect.endTime); float len = end - start; float frameLen = frameEnd - frameStart; power = Mathf.Pow(power, len / frameLen); } return(power); }
static float GetEffectValue(AppliedEffect effect, float frameStart, float frameEnd) { //TODO figure out how to handle range. Probably doesn't matter, but >= effect.startime if (effect.endTime < frameStart || effect.startTime > frameEnd) { return(0f); } if (effect.duration == 0) { return(effect.amount); } float start = Mathf.Max(frameStart, effect.startTime); float end = Mathf.Min(frameEnd, effect.endTime); float len = end - start; //TODO actually test this //at least doesn't work for an effect len of 0 return(effect.amount * (len / effect.duration)); }
private static void AssignEffects(List <Actor> party) { foreach (var actor in party) { // attaching effects List <Effect> actorEffects = new List <Effect>(); var characterEffectDetailsList = CharacterEffects[(Characters)actor.CharacterId]; foreach (var effectDetailsReference in characterEffectDetailsList) { var effectDetails = Effects[effectDetailsReference]; Targeter targeter = effectDetails.targeter; AppliedEffect appliedEffect = effectDetails.appliedEffect; string animation = effectDetails.animation; Effect effect = new Effect(targeter, appliedEffect, animation); actorEffects.Add(effect); } Effect[] effectArray = actorEffects.ToArray(); ActorAction2 actorAction = new ActorAction2(effectArray); actor.ActorAction = actorAction; } }
static float GetUnshieldedDamage(ref List <AppliedEffect> shieldEffects, float frameTime, float damage) { //TODO make list sorted by default shieldEffects.Sort((x, y) => x.endTime.CompareTo(y.endTime)); for (int i = 0; i < shieldEffects.Count; i++) { AppliedEffect effect = shieldEffects[i]; if (frameTime < effect.startTime || frameTime > effect.endTime) { continue; } if (effect.amount > damage) { effect.amount -= damage; shieldEffects[i] = effect; return(0f); } damage -= effect.amount; effect.amount = 0; shieldEffects[i] = effect; } return(damage); }
public Effect(Targeter targeter, AppliedEffect appliedEffect, string animation) { Targeter = targeter; AppliedEffect = appliedEffect; Animation = animation; }