Sp00ky Ghost Ship Behavior (Creepylava System)

Posts 1–3 of 3 · Page 1 of 1
Sp00ky Ghost Ship Behavior (Creepylava System)
Hi. Here is a behavior for Fabiano/Creepylava/Seraph behavior system or whatever you want to call of it. It's kind of clunky but it should do. I'll provide the setpiece I snatched from Clubs and edited it to work with this source and ofc all of the behavior that is needed for the event.
swaq.

Behavior
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using wServer.logic.behaviors;
using wServer.logic.loot;
using wServer.logic.transitions;
using wServer.realm;
using wServer.realm.entities;
using wServer.realm.entities.player;

namespace wServer.logic
{
    partial class BehaviorDb
    {
        private _ GhostShip = () => Behav()
        //made by omni the greatest rapper ever
                    .Init("Vengeful Spirit",
                new State(
                    new State("Start",
                        new ChangeSize(50, 120),
                        new Prioritize(
                            new Follow(0.48, 8, 1),
                            new Wander(0.45)
                            ),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 16, coolDown: 1000),
                        new TimedTransition(1000, "Vengeful")
                        ),
                    new State("Vengeful",
                        new Prioritize(
                            new Follow(1, 8, 1),
                            new Wander(0.45)
                            ),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 16, coolDown: 1645),
                        new TimedTransition(3000, "Vengeful2")
                        ),
                        new State("Vengeful2",
                        new ReturnToSpawn(once: false, speed: 0.6),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 16, coolDown: 1500),
                        new TimedTransition(1500, "Vengeful")
                        )))
                   .Init("Water Mine",
                    new State(
                       new State("Seek",
                        new Prioritize(
                            new Follow(0.45, 8, 1),
                            new Wander(0.55)
                            ),
                        new TimedTransition(3750, "Boom")
                        ),
                        new State("Boom",
                        new Shoot(8.4, count: 10, projectileIndex: 0, coolDown: 1000),
                        new Suicide()
                 )))
                 .Init("Beach Spectre",
                    new State(
                       new State("Fight",
                           new Wander(0.03),
                       new ChangeSize(10, 120),
                       new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 14, coolDown: 1750)
                 )))

                 .Init("Beach Spectre Spawner",
                    new State(
                       new ConditionalEffect(ConditionEffectIndex.Invincible),
                       new State("Spawn",
                       new Reproduce("Beach Spectre", densityMax: 1, densityRadius: 3, spawnRadius: 1, coolDown: 1250)
                 )))
                  .Init("Tempest Cloud",
                    new State(
                        new ConditionalEffect(ConditionEffectIndex.Invincible),
                    new State("Start1",
                       new ChangeSize(70, 130),
                       new TimedTransition(3000, "Start2")
                 ),
                    new State("Start2",
                       new SetAltTexture(1),
                       new TimedTransition(1, "Start3")
                 ),
                    new State("Start3",
                       new SetAltTexture(2),
                       new TimedTransition(1, "Start4")
                 ),
                     new State("Start4",
                       new SetAltTexture(3),
                       new TimedTransition(1, "Start5")
                 ),
                     new State("Start5",
                       new SetAltTexture(4),
                       new TimedTransition(1, "Start6")
                 ),
                     new State("Start6",
                       new SetAltTexture(5),
                       new TimedTransition(1, "Start7")
                 ),
                     new State("Start7",
                       new SetAltTexture(6),
                       new TimedTransition(1, "Start8")
                 ),
                     new State("Start8",
                       new SetAltTexture(7),
                       new TimedTransition(1, "Start9")
                 ),
                     new State("Start9",
                       new SetAltTexture(8),
                       new TimedTransition(1, "Final")
                 ),
                     new State("Final",
                       new SetAltTexture(9),
                       new TimedTransition(1, "CircleAndStorm")
                 ),
                     new State("CircleAndStorm",
                       new Orbit(0.25, 9, 20, "Ghost Ship Anchor", speedVariance: 0.1),
                       new Shoot(8.4, count: 7, projectileIndex: 0, coolDown: 1000)
                 )))
                .Init("Ghost Ship Anchor",
                    new State(
                       new State("idle",                        
                       new ConditionalEffect(ConditionEffectIndex.Invincible)
                 ),
                    new State("tempestcloud",
                        new InvisiToss("Tempest Cloud", 9, 0, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 45, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 90, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 135, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 180, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 225, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 270, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 315, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 350, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 250, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 110, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 200, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 10, coolDown: 9999999),
                        new InvisiToss("Tempest Cloud", 9, 290, coolDown: 9999999),

                        //Spectre Spawner
                        new InvisiToss("Beach Spectre Spawner", 17, 0, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 45, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 90, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 135, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 180, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 225, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 270, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 315, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 250, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 110, coolDown: 9999999),
                        new InvisiToss("Beach Spectre Spawner", 17, 200, coolDown: 9999999),
                       new ConditionalEffect(ConditionEffectIndex.Invincible)
                 )

                        ))
                    .Init("Ghost Ship",
                new State(
                    new DropPortalOnDeath("Davy Jones' Locker Portal", 21),
                    new OnDeathBehavior(
                        new RemoveEntity(100, "Tempest Cloud")
                        ),
                    new OnDeathBehavior(
                        new RemoveEntity(100, "Beach Spectre")
                        ),
                     new OnDeathBehavior(
                        new RemoveEntity(100, "Beach Spectre Spawner")
                        ),
                    new State("idle",
                        new SetAltTexture(1),
                        new Wander(0.1),
                        new DamageTakenTransition(2000, "pause")
                        ),
                    new State("pause",
                         new SetAltTexture(2),
                        new ConditionalEffect(ConditionEffectIndex.Invulnerable),
                        new TimedTransition(2000, "start")
                        ),
                      new State("start",
                           new SetAltTexture(0),
                      new Reproduce("Vengeful Spirit", densityMax: 2, spawnRadius: 1, coolDown: 1000),
                      new TimedTransition(15000, "midfight"),
                       new State("2",
                        new SetAltTexture(0),
                        new Prioritize(
                             new Wander(0.45),
                             new StayBack(0.3, 5)
                            ),
                        new Shoot(8.4, count: 1, projectileIndex: 0,  coolDown: 450),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 20, coolDown: 1750),
                        new TimedTransition(3250, "1")
                        ),
                     new State("1",
                        new TossObject("Water Mine", 5, coolDown: 1500),
                        new ConditionalEffect(ConditionEffectIndex.Invulnerable),
                        new ReturnToSpawn(once: false, speed: 0.4),
                        new Shoot(8.4, count: 1, projectileIndex: 0, coolDown: 450),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 20, coolDown: 1750),
                        new TimedTransition(1500, "2")
                         )
                        ),


                       new State("midfight",
                     new Order(100, "Ghost Ship Anchor", "tempestcloud"),
                      new Reproduce("Vengeful Spirit", densityMax: 1, spawnRadius: 1, coolDown: 1000),
                      new TossObject("Water Mine", 5, coolDown: 2250),                      
                      new TimedTransition(10000, "countdown"),
                       new State("2",
                        new SetAltTexture(0),
                        new ReturnToSpawn(once: false, speed: 0.4),
                        new ConditionalEffect(ConditionEffectIndex.Invulnerable),
                        new Shoot(10, count: 4, projectileIndex: 0, coolDownOffset: 1100, angleOffset: 270, coolDown: 1250),
                        new Shoot(10, count: 4, projectileIndex: 0, coolDownOffset: 1100, angleOffset: 90, coolDown: 1250),
                        new Shoot(8.4, count: 1, projectileIndex: 1, coolDown: 1250),
                        new TimedTransition(3000, "1")
                        ),
                     new State("1",
                        new Prioritize(
                             new Follow(0.45, 8, 1),
                             new Wander(0.3)
                            ),
                        new Taunt(1.00, "Fire at will!"),
                        new Shoot(8.4, count: 2, shootAngle: 25, projectileIndex: 1, coolDown: 3850),
                        new Shoot(8.4, count: 6, projectileIndex: 0, shootAngle: 10, coolDown: 2750),
                        new TimedTransition(4000, "2")
                         )
                        ),
                    new State("countdown",
                        new Wander(0.1),
                        new Timed(1000,
                            new Taunt(1.00, "Ready..")
                            ),
                         new Timed(2000,
                            new Taunt(1.00, "Aim..")
                            ),
                        new Shoot(8.4, count: 1, projectileIndex: 0, coolDown: 450),
                        new Shoot(8.4, count: 3, projectileIndex: 0, shootAngle: 20, coolDown: 750),
                        new TimedTransition(2000, "fire")
                        ),
                    new State("fire",
                       new Prioritize(
                             new Follow(0.36, 8, 1),
                             new Wander(0.12)
                            ),
                         new Shoot(10, count: 4, projectileIndex: 1, coolDownOffset: 1100, angleOffset: 270, coolDown: 1250),
                        new Shoot(10, count: 4, projectileIndex: 1, coolDownOffset: 1100, angleOffset: 90, coolDown: 1250),
                        new Shoot(8.4, count: 10, projectileIndex: 0, coolDown: 3400),
                        new TimedTransition(3400, "midfight")
                        )

               ),
                new MostDamagers(3,
                    new ItemLoot("Potion of Wisdom", 1.0)
                ),
                new ItemLoot("Ghost Pirate Rum", 1.0),
                new Threshold(0.025,
                    new TierLoot(9, ItemType.Weapon, 0.1),
                    new TierLoot(4, ItemType.Ability, 0.1),
                    new TierLoot(5, ItemType.Ability, 0.05),
                    new TierLoot(9, ItemType.Armor, 0.1),
                    new TierLoot(3, ItemType.Ring, 0.05),
                    new TierLoot(10, ItemType.Armor, 0.05),
                    new TierLoot(11, ItemType.Armor, 0.04),
                    new TierLoot(10, ItemType.Weapon, 0.05),
                    new TierLoot(11, ItemType.Weapon, 0.04),
                    new TierLoot(4, ItemType.Ring, 0.025),
                    new TierLoot(5, ItemType.Ring, 0.02),
                    new EggLoot(EggRarity.Common, 0.05),
                    new EggLoot(EggRarity.Uncommon, 0.025),
                    new EggLoot(EggRarity.Rare, 0.02),
                    new EggLoot(EggRarity.Legendary, 0.005)
                )
            )



        ;
    }
}


Setpiece
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using wServer.logic.loot;
using wServer.realm.entities;
using db.data;

namespace wServer.realm.setpieces
{
    class GhostShip : ISetPiece
    {
        public int Size
        {
            get { return 50; }
        }

        private static readonly string Tree = "Tree Jungle";
        private static readonly string Water = "GhostWater";
        private static readonly string Sand = "Ghost Water Beach";
        
        Random rand = new Random();
        public void RenderSetPiece(World world, IntPoint pos)
        {
            XmlData dat = world.Manager.GameData;
            int DarkGrassradiu = 17;
            int sandRadius = 17;
            int waterRadius = 14;

            List<IntPoint> border = new List<IntPoint>();

            int[,] o = new int[Size, Size];
            int[,] t = new int[Size, Size];

            for (int y = 0; y < Size; y++)      //Outer
                for (int x = 0; x < Size; x++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy);
                    if (r <= sandRadius)
                        t[x, y] = 2;
                }
            for (int y = 0; y < Size; y++)      //Water
                for (int x = 0; x < Size; x++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy);
                    if (r <= waterRadius)
                    {
                        t[x, y] = 3;
                    }
                }

            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    if (((x > 5 && x < DarkGrassradiu) || (x < Size - 5 && x > Size - DarkGrassradiu) ||
                         (y > 5 && y < DarkGrassradiu) || (y < Size - 5 && y > Size - DarkGrassradiu)) &&
                        o[x, y] == 0 && t[x, y] == 1)
                    {
                        t[x, y] = 4;
                    }
                }
            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.ObjId = dat.IdToObjectType[Tree];
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                    else if (t[x, y] == 2)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = dat.IdToTileType[Sand];
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                    else if (t[x, y] == 3)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = dat.IdToTileType[Water];
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                    else if (t[x, y] == 4)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.ObjId = dat.IdToObjectType[Tree];
                        if (tile.ObjId == 0) tile.ObjId = world.GetNextEntityId();
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }

            Entity gship = Entity.Resolve(world.Manager, "Ghost Ship");
            gship.Move(pos.X + Size / 2f, pos.Y + Size / 2f);
            world.EnterWorld(gship);

            Entity gshipanchor = Entity.Resolve(world.Manager, "Ghost Ship Anchor");
            gshipanchor.Move(pos.X + Size / 2f, pos.Y + Size / 2f);
            world.EnterWorld(gshipanchor);

        }


    }
}


Have fun! ^.^ and remember eggplant isnt a vegetable. its a grain
this is only for fabiano btw guys xD
Quote Originally Posted by Kierze View Post
this is only for fabiano btw guys xD
r u sp00ked by the sp00ky sc4ry gh0st sh1p
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us