Exemplo n.º 1
0
 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() };
 }
Exemplo n.º 2
0
 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();
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 //ADD/REMOVE TO/FROM APPROPRIATE AFFECTER LIST
 public void AddAffecter(Affecter _affecter)
 {
     if (_affecter.Enact(this))
     {
         affecterList.Add(_affecter);
     }
 }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
 public void AddToInteractorList(Affecter _affecter)
 {
     inAffecter        = true;
     inAffecterChanged = true;
     timer             = 0;
     Tick();
     interactorList.Add(_affecter);
 }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
 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;
 }
Exemplo n.º 9
0
 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));
 }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
 //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();
     }
 }
Exemplo n.º 12
0
        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);
        }
Exemplo n.º 13
0
 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;
 }
Exemplo n.º 14
0
    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);
    }
Exemplo n.º 15
0
 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
                 }
             }
         }
     }
 }
Exemplo n.º 16
0
 //GET/SET SPREADLIST
 public void AddToSpreadList(Affecter _affecter)
 {
     spreadList.Add(_affecter);
 }
Exemplo n.º 17
0
 public void AddToTraitList(Affecter _affecter)
 {
     traitList.Add(_affecter);
 }
Exemplo n.º 18
0
 public void AddToAffecterList(Affecter _affecter)
 {
     affecterList.Add(_affecter);
 }
Exemplo n.º 19
0
 public void RemoveFromTraitList(Affecter _affecter)
 {
     traitList.Remove(_affecter);
 }
Exemplo n.º 20
0
 public void RemoveFromAffecterList(Affecter _affecter)
 {
     affecterList.Remove(_affecter);
 }
Exemplo n.º 21
0
 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() };
 }
Exemplo n.º 22
0
 public void RemoveFromLayerList(Affecter _affecter)
 {
     layerList.Remove(_affecter);
 }
Exemplo n.º 23
0
 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;
 }
Exemplo n.º 24
0
 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() };
 }
Exemplo n.º 25
0
 public void RemoveFromSpreadList(Affecter _affecter)
 {
     spreadList.Remove(_affecter);
 }
Exemplo n.º 26
0
 //GET/SET LAYERLIST
 public void AddToLayerList(Affecter _affecter, int ind = 0)
 {
     layerList.Insert(ind, _affecter);
 }
Exemplo n.º 27
0
 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() };
 }
Exemplo n.º 28
0
 public int GetLayerVal(Affecter _affecter)
 {
     return(layerList.IndexOf(_affecter));
 }
Exemplo n.º 29
0
 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() };
 }