List <ActiveCurse> ResolvedCurseStack(List <ActiveCurse> list) { Dictionary <EffectSource, List <ActiveCurse> > resolve = new Dictionary <EffectSource, List <ActiveCurse> >(); foreach (ActiveCurse ab in list) { EffectSource es = ab.effectSource; if (resolve.ContainsKey(es) == false) { resolve.Add(es, new List <ActiveCurse>()); } resolve[es].Add(ab); } List <ActiveCurse> output = new List <ActiveCurse>(); foreach (List <ActiveCurse> tList in resolve.Values) { //Add the first element with damage AND stats output.Add(tList[0]); for (int i = 1; i < tList.Count; i++) { output.Add(tList[i].CloneWithoutStats()); } } return(output); }
public void SetSources(FormSource formSource, EffectSource givesEffectSource, FormSource exclusiveToFormSource, ItemSource exlusiveToItemSource) { this.FormSource = formSource; this.GivesEffectSource = givesEffectSource; this.ExclusiveToFormSource = exclusiveToFormSource; this.ExclusiveToItemSource = exlusiveToItemSource; }
public AudioController(GameObject owner) { this.owner = owner; music = new MusicSource(owner); effect = new EffectSource(owner); serverController = owner.GetComponent <ServerController>(); }
public void AddEffectSoundTo(GameObject go, string effectName) { EffectSound sound = Array.Find(EffectSounds, s => s.Name == effectName); if (sound != null) { EffectSource source = go.AddComponentNotExist <EffectSource>(); source.SetSound(sound); source.SetVolume(EffectVolume); EffectSoundsCatcher.Add(source); } }
public override bool ApplyDamage(float damage, EffectSource damageType, Collision2D coll) { //if we're already marked for death, don't apply more damage if (markedForDeath || invulnerable) { return false; } bool damageDealt = false; if (damagedBy == EffectSource.Universal || damageType == EffectSource.Universal || damagedBy == damageType) { damageDealt = true; DoDamage(damage); } return damageDealt; }
public void Init() { skill = new SkillSourceBuilder() .With(ss => ss.Id, 55) .BuildAndSave(); form = new FormSourceBuilder() .With(f => f.Id, 3) .BuildAndSave(); exclusiveToForm = new FormSourceBuilder() .With(f => f.Id, 7) .BuildAndSave(); exlusiveToItem = new ItemSourceBuilder() .With(i => i.Id, 100) .BuildAndSave(); givesEffect = new EffectSourceBuilder() .With(i => i.Id, 78) .BuildAndSave(); }
public virtual bool ApplyDamage(float damage, EffectSource damageType, Collision2D coll, Collider2D other) { //if we're already marked for death, don't apply more damage if (markedForDeath || invulnerable) { return(false); } bool damageDealt = false; if (damagedBy == EffectSource.Universal || damageType == EffectSource.Universal || damagedBy == damageType) { damageDealt = true; CurrentHP = CurrentHP - damage; markedForDeath = !(privCurrentHP > 0.0f); if (doDamageEffectsOnDeath || !markedForDeath) { foreach (GameEffect effect in damagedEffects) { effect.ActivateEffect(gameObject, damage, coll, other); } } if (markedForDeath) { foreach (GameEffect effect in deathEffects) { effect.ActivateEffect(gameObject, damage, coll, other); } } } return(damageDealt); }
public virtual bool ApplyDamage(float damage, EffectSource damageType, Collision2D coll, Collider2D other) { //if we're already marked for death, don't apply more damage if (markedForDeath || invulnerable) { return false; } bool damageDealt = false; if (damagedBy == EffectSource.Universal || damageType == EffectSource.Universal || damagedBy == damageType) { damageDealt = true; CurrentHP = CurrentHP - damage; markedForDeath = !(privCurrentHP > 0.0f); if (doDamageEffectsOnDeath || !markedForDeath) { foreach (GameEffect effect in damagedEffects) { effect.ActivateEffect(gameObject, damage, coll, other); } } if (markedForDeath) { foreach (GameEffect effect in deathEffects) { effect.ActivateEffect(gameObject, damage, coll, other); } } } return damageDealt; }
public override void Execute(IDataContext context) { ContextQuery = ctx => { var skillSource = ctx.AsQueryable <SkillSource>().SingleOrDefault(t => t.Id == SkillSourceId); if (skillSource == null) { throw new DomainException($"StaticSkill Source with Id {SkillSourceId} could not be found"); } FormSource formSource = null; EffectSource givesEffectSource = null; FormSource exclusiveToFormSource = null; ItemSource exclusiveToItemSource = null; if (FormSourceId != null || FormSourceId > 0) { formSource = ctx.AsQueryable <FormSource>().SingleOrDefault(t => t.Id == FormSourceId); if (formSource == null) { throw new DomainException( $"FormSource Source with id '{FormSourceId}' could not be found. Does it need to be published first?"); } } if (GivesEffectSourceId != null) { givesEffectSource = ctx.AsQueryable <EffectSource>().SingleOrDefault(t => t.Id == GivesEffectSourceId); if (givesEffectSource == null) { throw new DomainException($"EffectSource with Id '{GivesEffectSourceId}' could not be found"); } } if (ExclusiveToFormSourceId != null && ExclusiveToFormSourceId.Value > 0) { exclusiveToFormSource = ctx.AsQueryable <FormSource>().SingleOrDefault(t => t.Id == ExclusiveToFormSourceId); if (exclusiveToFormSource == null) { throw new DomainException( $"ExclusiveToFormSourceId with id '{ExclusiveToFormSourceId}' could not be found"); } } if (ExclusiveToItemSourceId != null) { exclusiveToItemSource = ctx.AsQueryable <ItemSource>().SingleOrDefault(t => t.Id == ExclusiveToItemSourceId); if (exclusiveToFormSource == null) { throw new DomainException( $"ExclusiveToItemSource with id '{ExclusiveToItemSourceId}' could not be found"); } } skillSource.SetSources(formSource, givesEffectSource, exclusiveToFormSource, exclusiveToItemSource); ctx.Update(skillSource); ctx.Commit(); }; ExecuteInternal(context); }
public override bool ApplyDamage(float damage, EffectSource damageType, Collision2D coll) { return parentToDamage.ApplyDamage(damage, damageType, coll); }