예제 #1
0
        public InvaderCaptain(InvasionType type) : base(type)
        {
            SetStr(250);
            SetDex(SpellCaster ? 150 : 200);
            SetInt(SpellCaster ? 1000 : 5000);

            SetHits(8000, 12000);

            if (AI == AIType.AI_Melee)
            {
                SetDamage(22, 30);
            }
            else if (!SpellCaster)
            {
                SetDamage(20, 28);
            }
            else
            {
                SetDamage(10, 20);
            }

            Fame  = 48000;
            Karma = -48000;
        }
 /// <summary>
 /// Checks whether an invasion is occurring.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static bool IsInvasionOccurring(InvasionType type)
 {
     return(type == invasionType);
 }
예제 #3
0
        public Invader(SkillName specialty, InvasionType type)
            : base(GetAI(specialty), FightMode.Closest, 10, 1, .2, .1)
        {
            _Specialty    = specialty;
            _InvasionType = type;

            if (_Specialty == SkillName.Bushido && Utility.RandomBool())
            {
                _Sampire = true;
            }

            if (Female = Utility.RandomBool())
            {
                //Body = 0x191;
                Name = NameList.RandomName("female");
            }
            else
            {
                //Body = 0x190;
                Name = NameList.RandomName("male");
            }

            SetBody();

            string title;

            if (_Sampire)
            {
                title = "the sampire";
            }
            else if (specialty == SkillName.Magery)
            {
                title = "the wizard";
            }
            else
            {
                title = String.Format("the {0}", Skills[specialty].Info.Title);
                if (Female && title.EndsWith("man"))
                {
                    title = title.Substring(0, title.Length - 3) + "woman";
                }
            }

            Title = title;

            SetStr(120, 170);
            SetDex(SpellCaster ? 75 : 150);
            SetInt(SpellCaster ? 1800 : 500);

            SetHits(800, 1250);

            if (AI == AIType.AI_Melee)
            {
                SetDamage(15, 28);
            }
            else if (!SpellCaster)
            {
                SetDamage(12, 22);
            }
            else
            {
                SetDamage(8, 18);
            }

            Fame  = 8000;
            Karma = -8000;

            SetResists();
            SetSkills();
            EquipSpecialty();

            _NextSpecial = DateTime.UtcNow;

            if (_Sampire)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                {
                    VampiricEmbraceSpell spell = new VampiricEmbraceSpell(this, null);
                    spell.Cast();
                });
            }
        }
예제 #4
0
 public Invader(InvasionType type)
     : this(RandomSpecialty(), type)
 {
 }
        private static void UpdateInvasion()
        {
            if (invasionType > 0)
            {
                if (invasionSize <= 0)
                {
                    if (invasionType == InvasionType.GOBLIN_ARMY)
                    {
                        NPC.downedGoblins = true;
                        NetMessage.SendData(7);
                    }
                    else if (invasionType == InvasionType.FROST_LEGION)
                        NPC.downedFrost = true;

                    InvasionWarning();
                    invasionType = 0;
                    invasionDelay = 7;
                }
                if (invasionX == (double)spawnTileX)
                    return;
                float num = 0.2f;
                if (invasionX > (double)spawnTileX)
                {
                    invasionX -= (double)num;
                    if (invasionX <= (double)spawnTileX)
                    {
                        invasionX = (double)spawnTileX;
                        InvasionWarning();
                    }
                    else
                        invasionWarn--;
                }
                else if (invasionX < (double)spawnTileX)
                {
                    invasionX += (double)num;
                    if (invasionX >= (double)spawnTileX)
                    {
                        invasionX = (double)spawnTileX;
                        InvasionWarning();
                    }
                    else
                        invasionWarn--;
                }
                if (invasionWarn <= 0)
                {
                    invasionWarn = 3600;
                    InvasionWarning();
                }
            }
        }
        /// <summary>
        /// Invokes a new invasion based on the type.
        /// </summary>
        /// <param name="type"></param>
        public static void StartInvasion(InvasionType type = InvasionType.GOBLIN_ARMY)
        {
            if (invasionType == 0 && invasionDelay == 0)
            {
                int healthy = 0;
                for (int i = 0; i < MAX_PLAYERS; i++)
                {
                    if (players[i].Active && players[i].statLifeMax >= 200)
                        healthy++;
                }

                if (healthy > 0)
                {
                    invasionType = type;
                    invasionSize = 80 + 40 * healthy;
                    invasionWarn = 0;

                    if (rand.Next(2) == 0)
                    {
                        invasionX = 0.0;
                        return;
                    }

                    invasionX = (double)maxTilesX;
                }
            }
        }
 /// <summary>
 /// Checks whether an invasion is occurring.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static bool IsInvasionOccurring(InvasionType type)
 {
     return type == invasionType;
 }
예제 #8
0
파일: World.cs 프로젝트: jayands/tAPI-SDK
 /// <summary>
 /// Starts an invasion.
 /// </summary>
 /// <param name="invasion">
 /// The invasion to start.
 /// If <paramref name="invasion"/> equals <see cref="TAPI.SDK.InvasionType"/>.None, use <see cref="TAPI.SDK.World"/>.StopInvasion to stop all invasions.
 /// </param>
 public static void StartInvasion(InvasionType invasion)
 {
     Main.invasionDelay = 0;
     Main.StartInvasion((int)invasion);
 }
예제 #9
0
파일: World.cs 프로젝트: jayands/tAPI-SDK
 /// <summary>
 /// Starts an invasion.
 /// </summary>
 /// <param name="invasion">
 /// The invasion to start.
 /// If <paramref name="invasion"/> equals <see cref="TAPI.SDK.InvasionType"/>.None, use <see cref="TAPI.SDK.World"/>.StopInvasion to stop all invasions.
 /// </param>
 public static void StartInvasion(InvasionType invasion)
 {
     Main.invasionDelay = 0;
     Main.StartInvasion((int)invasion);
 }
예제 #10
0
        public Invader(SkillName specialty, InvasionType type)
            : base(GetAI(specialty), FightMode.Closest, 10, 1, .2, .1)
        {
            _Specialty = specialty;
            _InvasionType = type;

            if (_Specialty == SkillName.Bushido && Utility.RandomBool())
                _Sampire = true;

            if (Female = Utility.RandomBool())
            {
                //Body = 0x191;
                Name = NameList.RandomName("female");
            }
            else
            {
                //Body = 0x190;
                Name = NameList.RandomName("male");
            }

            SetBody();

            string title;

            if (_Sampire)
            {
                title = "the sampire";
            }
            else if (specialty == SkillName.Magery)
            {
                title = "the wizard";
            }
            else
            {
                title = String.Format("the {0}", Skills[specialty].Info.Title);
                if (Female && title.EndsWith("man"))
                    title = title.Substring(0, title.Length - 3) + "woman";
            }

            Title = title;

            SetStr(120, 170);
            SetDex(SpellCaster ? 75 : 150);
            SetInt(SpellCaster ? 1800 : 500);

            SetHits(800, 1250);

            if (AI == AIType.AI_Melee)
                SetDamage(15, 28);
            else if (!SpellCaster)
                SetDamage(12, 22);
            else
                SetDamage(8, 18);

            Fame = 8000;
            Karma = -8000;  

            SetResists();
            SetSkills();
            EquipSpecialty();

            _NextSpecial = DateTime.UtcNow;

            if (_Sampire)
            {
                Timer.DelayCall(TimeSpan.FromSeconds(1), () =>
                    {
                        VampiricEmbraceSpell spell = new VampiricEmbraceSpell(this, null);
                        spell.Cast();
                    });
            }
        }
예제 #11
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            NetPacketType type = (NetPacketType)reader.ReadByte();

            if (type != NetPacketType.Custom)
            {
                //Currently only server can said us what we should do
                if (whoAmI != 256)
                {
                    return;
                }
            }

            if (type == NetPacketType.EventWasStarted)
            {
                var name = reader.ReadString();
                foreach (WorldEvent it in EventsPool)
                {
                    if (it.GetType().Name == name)
                    {
                        ModContent.GetInstance <EventWorld>().StartWorldEvent(it);
                        break;
                    }
                }

                if (ModContent.GetInstance <EventWorld>().CurrentEvent == null)
                {
                    Main.NewText(
                        $"WARNING! You ether or disable FunMode or you are using outdated version of mod, what haven't an {name} event! Switching to NoSync mode...");
                }

                ModContent.GetInstance <EventWorld>().CurrentEvent.TimeLeft = reader.ReadInt32();
                InvasionType invType = (InvasionType)reader.ReadByte();
                if (invType == InvasionType.Invasion)
                {
                    Main.invasionProgressWave = reader.ReadInt32();
                    Main.invasionSizeStart    = reader.ReadInt32();
                    Main.invasionSize         = reader.ReadInt32();
                    Main.invasionType         = reader.ReadInt32();
                    Main.invasionX            = reader.ReadDouble();
                    Main.invasionProgress     = reader.ReadInt32();
                }
            }
            else if (type == NetPacketType.EventWaveUpdated)
            {
                var name = reader.ReadString();
                if (ModContent.GetInstance <EventWorld>().CurrentEvent == null ||
                    ModContent.GetInstance <EventWorld>().CurrentEvent.GetType().Name != name)
                {
                    //if (ModContent.GetInstance<EventWorld>().CurrentEvent == null)
                    //    Main.NewText($"WARNING! Currently you wont have any executing event, but server send wave update for {name} event!");
                    if (ModContent.GetInstance <EventWorld>().CurrentEvent.GetType().Name != name)
                    {
                        Main.NewText(
                            $"ERROR! Currently executing event not the same what server sends! Executed event is: {ModContent.GetInstance<EventWorld>().CurrentEvent.GetType().Name}. Server has {name} event!");
                        ModContent.GetInstance <EventWorld>().CurrentEvent
                        .EventEnd(ModContent.GetInstance <EventWorld>(), this);
                        ModContent.GetInstance <EventWorld>().CurrentEvent = null;
                    }


                    foreach (WorldEvent it in EventsPool)
                    {
                        if (it.GetType().Name == name)
                        {
                            ModContent.GetInstance <EventWorld>().StartWorldEvent(it);
                            break;
                        }
                    }

                    if (ModContent.GetInstance <EventWorld>().CurrentEvent == null)
                    {
                        //Main.NewText($"WARNING! You ether or disable FunMode or you are using outdated version of mod, what haven't an {name} event!");
                    }
                }

                ModContent.GetInstance <EventWorld>().CurrentEvent.TimeLeft = reader.ReadInt32();
                InvasionType invType = (InvasionType)reader.ReadByte();
                if (invType == InvasionType.Invasion)
                {
                    Main.invasionProgressWave = reader.ReadInt32();
                    Main.invasionSizeStart    = reader.ReadInt32();
                    Main.invasionSize         = reader.ReadInt32();
                    Main.invasionType         = reader.ReadInt32();
                    Main.invasionX            = reader.ReadDouble();
                    Main.invasionProgress     = reader.ReadInt32();
                    ModContent.GetInstance <EventWorld>().CurrentEvent.OnWaveChange();
                }
            }
            else if (type == NetPacketType.EventEnded)
            {
                var name = reader.ReadString();
                if (ModContent.GetInstance <EventWorld>().CurrentEvent == null ||
                    ModContent.GetInstance <EventWorld>().CurrentEvent.GetType().Name != name)
                {
                    if (ModContent.GetInstance <EventWorld>().CurrentEvent == null)
                    {
                        Main.NewText(
                            $"WARNING! Currently you wont have any executing event, but server send event end for {name} event!");
                    }
                    if (ModContent.GetInstance <EventWorld>().CurrentEvent.GetType().Name != name)
                    {
                        Main.NewText(
                            $"ERROR! Currently executing event not the same what server sends! Executed event is: {ModContent.GetInstance<EventWorld>().CurrentEvent.GetType().Name}. Server has {name} event!");
                        ModContent.GetInstance <EventWorld>().CurrentEvent
                        .EventEnd(ModContent.GetInstance <EventWorld>(), this);
                        ModContent.GetInstance <EventWorld>().CurrentEvent = null;
                    }
                }
                else
                {
                    ModContent.GetInstance <EventWorld>().CurrentEvent
                    .EventEnd(ModContent.GetInstance <EventWorld>(), this);
                    ModContent.GetInstance <EventWorld>().CurrentEvent = null;
                }
            }
            else if (type == NetPacketType.Custom)
            {
                #region Constants

                const string lunarSky   = "LunarSkies";
                const string netSendFix = "NetSend";

                #endregion

                var eve = reader.ReadString();
                if (eve == lunarSky)
                {
                    LunarSkies t = (LunarSkies)reader.ReadByte();
                    EventPlayer.LunarSky = t;
                }
                else if (eve == netSendFix)
                {
                    var b = reader.ReadBoolean();
                    if (b)
                    {
                        ModPacket p = GetPacket();
                        p.Write((byte)NetPacketType.Custom);
                        p.Write(netSendFix);
                        p.Write(false);
                        ModContent.GetInstance <EventWorld>().WriteNetSendData(p);
                        p.Send(whoAmI);
                    }
                    else
                    {
                        ModContent.GetInstance <EventWorld>().NetReceive(reader);
                    }
                }
            }
        }
예제 #12
0
 public Invader(InvasionType type)
     : this(RandomSpecialty(), type)
 {
 }
예제 #13
0
        public InvaderCaptain(InvasionType type) : base(type)
        {
            SetStr(250);
            SetDex(SpellCaster ? 150 : 200);
            SetInt(SpellCaster ? 1000 : 5000);

            SetHits(8000, 12000);

            if (AI == AIType.AI_Melee)
                SetDamage(22, 30);
            else if (!SpellCaster)
                SetDamage(20, 28);
            else
                SetDamage(10, 20);

            Fame = 48000;
            Karma = -48000;  
        }
예제 #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            _Specialty = (SkillName)reader.ReadInt();
            _InvasionType = (InvasionType)reader.ReadInt();
            _Sampire = reader.ReadBool();

            _NextSpecial = DateTime.UtcNow;
        }
예제 #15
0
 /// <summary>
 /// Starts an invasion.
 /// </summary>
 /// <param name="invasion">
 /// The invasion to start.
 /// If <paramref name="invasion"/> equals <see cref="PoroCYon.MCT.InvasionType"/>.None, use <see cref="PoroCYon.MCT.World"/>.StopInvasion to stop all invasions.
 /// </param>
 public static void StartInvasion(InvasionType invasion)
 {
     StartInvasion(VanillaInvasion(invasion));
 }
예제 #16
0
 /// <summary>
 /// Gets the Invasion instance of a vanilla invasion.
 /// </summary>
 /// <param name="invasion">The invasion type of the invasion.</param>
 /// <returns>The Invasion instance of the vanilla invasion.</returns>
 public static Invasion VanillaInvasion(InvasionType invasion)
 {
     return Invasion.FromID((int)invasion);
 }