public Harming(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Healing(), new DamageResist(), new DamageReduce() }; }
public static void save(Affecter affecter) { if (affecter.Id == 0) { OdbcCommand cmd = new OdbcCommand("insert into affecter (Numero, DateDebut,DateFin,id_ligne,id_bus) values(?,?,?,?,?)", AccesBd.getConnection()); cmd.Parameters.Add("@Numero", OdbcType.VarChar).Value = affecter.Numero; cmd.Parameters.Add("@DateDebut", OdbcType.DateTime).Value = affecter.DateDebut; cmd.Parameters.Add("@DateFin", OdbcType.DateTime).Value = affecter.DateFin; cmd.Parameters.Add("@idlig", OdbcType.VarChar).Value = affecter.ligne.Numero; cmd.Parameters.Add("@idbus", OdbcType.VarChar).Value = affecter.bus.Numero; cmd.ExecuteNonQuery(); cmd.Dispose(); } else { OdbcCommand cmd = new OdbcCommand("update affecter Numero=?, DateDebut=?,DateFin=?,id_ligne=?,id_bus=? where Id=?", AccesBd.getConnection()); cmd.Parameters.Add("@Numero", OdbcType.VarChar).Value = affecter.Numero; cmd.Parameters.Add("@DateDebut", OdbcType.DateTime).Value = affecter.DateDebut; cmd.Parameters.Add("@DateFin", OdbcType.DateTime).Value = affecter.DateFin; cmd.Parameters.Add("@idlig", OdbcType.VarChar).Value = affecter.ligne.Numero; cmd.Parameters.Add("@idbus", OdbcType.VarChar).Value = affecter.bus.Numero; cmd.Parameters.Add("@id", OdbcType.Int).Value = affecter.Id; cmd.ExecuteNonQuery(); cmd.Dispose(); } }
public Burning(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Fueling(), new Oiling(), new Winding(), new Dirtying() }; oilFire = false; foundOil = false; }
//ADD/REMOVE TO/FROM APPROPRIATE AFFECTER LIST public void AddAffecter(Affecter _affecter) { if (_affecter.Enact(this)) { affecterList.Add(_affecter); } }
public virtual bool Scan() //THIS IS THE METHOD THAT SCANS TO SEE IF ANOTHER EFFECT HAS A MATCHING REACTOR { List <Affecter> allLists = (targetBody.GetAffecterList().Concat(targetBody.GetTraitList())).ToList(); //COMBINES EFFECTLIST AND TRAITLIST for (int i = 0; i < allLists.Count; i++) //FOR EACH AFFECTER IN THE COMBINED LIST { Affecter affecter = allLists.ElementAt(i); //FOR EACH AFFECTER IN THE COMBINED LIST if (combinable && affecter.GetType() == GetType()) //CHECK WHETHER AFFECTERS SHOULD COMBINE { Combine(affecter); //COMBINE AFFECTERS return(false); } else //IF THEY SHOULDN'T COMBINE { for (int j = 0; j < reactorList.Count; j++) //FOR EACH REACTOR IN THE REACTOR LIST { Reactor reactor = reactorList.ElementAt(j); //FOR EACH REACTOR IN THE REACTOR LIST if (reactor.FindMatches(affecter) && (!interactorList.Contains(affecter))) //IF THE AFFECTER FROM THE COMBINED HAS A MATCHING REACTOR { interactorList.Add(affecter); //ADD THAT AFFECTER TO THE INTERACTOR LIST affecter.AddToInteractorList(this); } } } } return(true); }
public void AddToInteractorList(Affecter _affecter) { inAffecter = true; inAffecterChanged = true; timer = 0; Tick(); interactorList.Add(_affecter); }
public Reactor CloneReactor <T>(T _this, Affecter _affecter) where T : Reactor { T reactorClone = (T)_this.MemberwiseClone(); reactorClone.ResetVitality(); reactorClone.parentAffecter = _affecter; lastParentVitality = parentAffecter.GetTurnVitality(); return(reactorClone); }
public Reactor(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) { parentAffecter = _parentAffecter; vitality = _vitality; turnVitality = _vitality; fullVitality = 100f; natVitality = _vitality; lastParentVitality = parentAffecter.GetTurnVitality(); linkMod = _linkMod; immortal = _immortal; vital = _vital; }
protected void SetupAttack(Attack _attack, List <Affecter> _effects) { _attack.AttackConstructor(holder, speed); _attack.effects = _effects; for (int i = 0; i < _effects.Count; i++) { Affecter effect = _effects[i]; effect.ResetVitality(); _effects[i] = effect.GetAffecterClone(effect); } holder.SetCurrAct(new Recovery("Recovery", _attack.Rate * _attack.Duration, holder)); }
public static List <Affecter> findAll() { List <Affecter> affecters = new List <Affecter>(); OdbcCommand cmd = new OdbcCommand("select Id from affecter", AccesBd.getConnection()); OdbcDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { Affecter affecter = find(dr.GetInt32(0)); affecters.Add(affecter); } cmd.Dispose(); return(affecters); }
//TICK FUNCTION protected void Tick() { for (int i = 0; i < affecterList.Count; i++) { Affecter affecter = affecterList.ElementAt(i); affecter.Tick(); } mind.Tick(); currMoveAct.Tick(); currAct.Tick(); if (harmQuant > harmThreshold) { DieIdiot(); } }
public static Affecter findByNumero(string numero) { Affecter affecter = null; OdbcCommand cmd = new OdbcCommand("select * from affecter where Numero=?", AccesBd.getConnection()); cmd.Parameters.Add("@numero", OdbcType.VarChar).Value = numero; OdbcDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { affecter = new Affecter { Id = dr.GetInt32(0), Numero = dr.GetString(1), DateDebut = dr.GetDateTime(2), DateFin = dr.GetDateTime(3), ligne = LigneDao.findByNumero(dr.GetString(4)), bus = BusDao.findByNumero(dr.GetString(5)) }; } cmd.Dispose(); return(affecter); }
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; }
public virtual bool FindMatches(Affecter _targetAffecter) { bool result = false; List <Reactor> otherList = _targetAffecter.GetReactorList(); for (int i = 0; i < otherList.Count; i++) { Reactor other = otherList.ElementAt(i); for (int j = 0; j < reactants.Length; j++) { Reactor own = reactants[j]; if (other.GetType() == own.GetType()) { React(other); result = true; } } } return(result); }
public virtual void Dewit() //THIS IS WHAT THE AFFECTER WILL PERFORM EVERY TURN, IF ACTIVE { vitality += vRate; //UPDATE VITALITY for (int i = 0; i < interactorList.Count; i++) //FOR EACH INTERACTOR IN THE LIST { Affecter interactor = interactorList.ElementAt(i); //FOR EACH INTERACTOR IN THE LIST if (!(interactor).IsPresent()) //IF THE INTERACTOR ISN'T ALIVE { interactorList.Remove(interactor); //DELET THIS continue; //IGNORE THE REST OF THE POTENTIAL INTERACTION WITH THIS INTERACTOR } if (layered && interactor.IsLayered()) //IF BOTH AFFECTERS ACT AS LAYERS { if (Mathf.Abs(targetBody.GetLayerVal(interactor) - targetBody.GetLayerVal(this)) > 1) //IF THE INTERACTOR ISN'T ONE LAYER BENEATH OR ABOVE { continue; //CEASE THE INTERACTION } } for (int j = 0; j < reactorList.Count; j++) //FOR EACH REACTOR IN THE REACTOR LIST { Reactor reactor = reactorList.ElementAt(j); //FOR EACH REACTOR IN THE REACTOR LIST if (reactor.vitality <= 0) //IF THE REACTOR IS DEAD { if (!reactor.IsImmortal()) //LIKE... DEAD { reactor.Deact(); //DELETE REACTOR if (reactor.IsVital()) //IF THE REACTOR IS VITAL { present = false; //DESTROY THE AFFECTER TO WHICH THE REACTOR IS ATTACHED return; } } else //IF THE REACTOR IS STILL ALIVE { reactor.FindMatches(interactor); //HANDLE ANY INTERACTIONS IT MIGHT HAVE WITH THE INTERACTOR } } } } }
//GET/SET SPREADLIST public void AddToSpreadList(Affecter _affecter) { spreadList.Add(_affecter); }
public void AddToTraitList(Affecter _affecter) { traitList.Add(_affecter); }
public void AddToAffecterList(Affecter _affecter) { affecterList.Add(_affecter); }
public void RemoveFromTraitList(Affecter _affecter) { traitList.Remove(_affecter); }
public void RemoveFromAffecterList(Affecter _affecter) { affecterList.Remove(_affecter); }
public ResistanceAdder(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.Infinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new DamageResist() }; }
public void RemoveFromLayerList(Affecter _affecter) { layerList.Remove(_affecter); }
public Drying(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Dampening() }; oilFire = false; }
public Chilling(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Heating(), new Watering() }; }
public void RemoveFromSpreadList(Affecter _affecter) { spreadList.Remove(_affecter); }
//GET/SET LAYERLIST public void AddToLayerList(Affecter _affecter, int ind = 0) { layerList.Insert(ind, _affecter); }
public Winding(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Burning(), new Dirtying(), new Puny() }; }
public int GetLayerVal(Affecter _affecter) { return(layerList.IndexOf(_affecter)); }
public PiercingResist(Affecter _parentAffecter, float _vitality = 1f, float _linkMod = Mathf.NegativeInfinity, bool _immortal = false, bool _vital = false) : base(_parentAffecter, _vitality, _linkMod, _immortal, _vital) { reactants = new Reactor[] { new Piercing() }; }