public Affecter GetAffecterClone <T>(T _this, bool spread = false) where T : Affecter { T affecterClone = (T)_this.MemberwiseClone(); affecterClone.present = true; affecterClone.inAffecter = true; affecterClone.inAffecterChanged = false; affecterClone.interactorList = new List <Affecter>(); affecterClone.reactorList = new List <Reactor>(); for (int i = 0; i < _this.reactorList.Count; i++) { Reactor reactor = _this.reactorList.ElementAt(i); affecterClone.reactorList.Add(reactor.CloneReactor(reactor, affecterClone)); } if (spread) { affecterClone.vitality *= spreadMod; affecterClone.turnVitality = affecterClone.vitality; } else { affecterClone.vitality = naturalVitality; affecterClone.turnVitality = affecterClone.vitality; } return(affecterClone); }
public virtual void Combine(Affecter combiner) { combiner.AffectVitality(vitality); for (int i = 0; i < reactorList.Count; i++) { Reactor ownReactor = reactorList.ElementAt(i); for (int j = 0; j < combiner.reactorList.Count; j++) { Reactor otherReactor = combiner.reactorList.ElementAt(j); if (ownReactor.GetType() != otherReactor.GetType()) { combiner.reactorList.Add(ownReactor.CloneReactor(ownReactor, combiner)); } } } //Deact(); //DELETE THE AFFECTER present = false; }