Пример #1
0
        public static NubiaBlessure getRandomBlessure()
        {
            NubiaBlessure blessure = null;

            blessure = new NubiaBlessure(Utility.RandomBool(), (BlessureGravite)Utility.Random(5),
                                         (BlessureType)Utility.Random(4), Utility.Random(5));
            return(blessure);
        }
Пример #2
0
        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write((int)2);//version;


            writer.Write((int)m_CreatureType);
            writer.Write((int)m_SousTypes.Count);
            for (int st = 0; st < m_SousTypes.Count; st++)
            {
                MobileSousType mst = m_SousTypes[st];
                writer.Write((int)mst);
            }


            //Charac additionelles
            writer.Write((int)mRawCha);
            writer.Write((int)mRawCons);
            writer.Write((int)mRawSag);

            //Compétences
            writer.Write((int)Competences.Lenght);
            for (int i = 0; i < (int)CompType.Maximum; i++)
            {
                if (!(Competences[(CompType)i] is NullCompetence))
                {
                    writer.Write((int)i); //Comptype
                    writer.Write((int)Competences[(CompType)i].Achat);
                }
            }


            //#Blessure
            writer.Write((int)m_blessureList.Count);
            for (int i = 0; i < m_blessureList.Count; i++)
            {
                NubiaBlessure blessure = m_blessureList[i] as NubiaBlessure;
                writer.Write((DateTime)blessure.TimeEnd);
                writer.Write((int)blessure.BType);
                writer.Write((int)blessure.BGravite);
                writer.Write((bool)blessure.Hemo);
                writer.Write((int)blessure.CurrentHemo);
                writer.Write((int)blessure.SoinStatut);
                writer.Write((int)blessure.Localisation);
            }

            writer.Write((int)m_ChakraColor);
        }
Пример #3
0
        public virtual void OnTurn()
        {
            //Console.WriteLine("NubiaMobile :: Tour");
            m_turn++;
            if (m_turn > 1000)
            {
                m_turn = 0;
            }


            if (IsRenverse)
            {
                mTourRenverse--;
                if (mTourRenverse == 0)
                {
                    Emote("*Se relève*");
                    SendMessage("Vous n'êtes plus renversé");
                }
                else
                {
                    ExposeToOpportunite();
                }
            }

            NubiaBlessure toRemov = null;

            foreach (NubiaBlessure blessure in BlessureList)
            {
                blessure.OnTurn(this);
                if (blessure.TimeEnd <= DateTime.Now)
                {
                    toRemov = blessure;
                    break;
                }
            }
            if (toRemov != null)
            {
                BlessureList.Remove(toRemov);
            }

            List <AbstractBaseBuff> buffRemoveList = new List <AbstractBaseBuff>();


            foreach (AbstractBaseBuff buff in BuffList)
            {
                if (Alive)
                {
                    buff.OnTurn();
                }
                if (buff.Turn < 1)
                {
                    buffRemoveList.Add(buff);
                }
            }


            foreach (AbstractBaseBuff debuff in DebuffList)
            {
                if (debuff == null)
                {
                    continue;
                }
                if (Alive)
                {
                    debuff.OnTurn();
                }
                if (debuff.Turn < 1)
                {
                    buffRemoveList.Add(debuff);
                }
            }

            while (buffRemoveList.Count > 0)
            {
                AbstractBaseBuff r = buffRemoveList[0];
                Console.WriteLine("Remove: " + r.Name);
                if (r.IsDebuff)
                {
                    DebuffList.Remove(r as BaseDebuff);
                }
                else
                {
                    BuffList.Remove(r);
                }
                buffRemoveList.RemoveAt(0);
            }
        }
Пример #4
0
 public void AddBlessure(NubiaBlessure blessure)
 {
     m_blessureList.Add(blessure);
     //if(blessure.BType != TypeBlessure.Hemoragie)
     Emote("*{0}!*", blessure.BType.ToString());
 }
Пример #5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();


            m_CreatureType = (MobileType)reader.ReadInt();
            int countSt = reader.ReadInt();

            for (int st = 0; st < countSt; st++)
            {
                MobileSousType mst = (MobileSousType)reader.ReadInt();
                m_SousTypes.Add(mst);
            }


            if (version >= 1)
            {
                //Charac additionelles
                mRawCha  = reader.ReadInt();
                mRawCons = reader.ReadInt();
                mRawSag  = reader.ReadInt();

                //Compétences
                int lenght = reader.ReadInt();
                mCompetences = new CompetenceStack(this);
                for (int i = 0; i < lenght; i++)
                {
                    CompType comp   = (CompType)reader.ReadInt();
                    int      achats = reader.ReadInt();
                    if (mCompetences[comp] is NullCompetence)
                    {
                        mCompetences.AddCompetence(comp);
                    }
                    mCompetences[comp].Achat = achats;
                }
            }
            if (version >= 2)
            {
                //### Blessures
                m_blessureList = new ArrayList();
                int count2 = reader.ReadInt();
                for (int i = 0; i < count2; i++)
                {
                    DateTime             btime    = reader.ReadDateTime();
                    BlessureType         btype    = (BlessureType)reader.ReadInt();
                    BlessureGravite      bgrav    = (BlessureGravite)reader.ReadInt();
                    bool                 bhemo    = reader.ReadBool();
                    int                  bhemoc   = reader.ReadInt();
                    int                  sta      = reader.ReadInt();
                    BlessureLocalisation bloc     = (BlessureLocalisation)reader.ReadInt();
                    NubiaBlessure        blessure = new NubiaBlessure(bhemo, bgrav, btype, bhemoc);
                    blessure.SoinStatut = sta;
                    blessure.setTimeEnd(btime);
                    blessure.setLocalisation(bloc);
                    m_blessureList.Add(blessure);
                }
            }

            m_ChakraColor = reader.ReadInt();
        }