// Token: 0x060018D6 RID: 6358 RVA: 0x0013EB70 File Offset: 0x0013CD70
 public override void Update(bool eu)
 {
     base.Update(eu);
     if (room.game.devToolsActive && Input.GetKey("b"))
     {
         firstChunk.vel += Custom.DirVec(firstChunk.pos, Input.mousePosition) * 3f;
     }
     lastRotation = rotation;
     if (grabbedBy.Count > 0)
     {
         rotation   = Custom.PerpendicularVector(Custom.DirVec(firstChunk.pos, grabbedBy[0].grabber.mainBodyChunk.pos));
         rotation.y = Mathf.Abs(rotation.y);
     }
     if (setRotation != null)
     {
         rotation    = setRotation.Value;
         setRotation = null;
     }
     if (base.firstChunk.ContactPoint.y < 0)
     {
         rotation = (rotation - Custom.PerpendicularVector(rotation) * 0.1f * base.firstChunk.vel.x).normalized;
         BodyChunk firstChunk = base.firstChunk;
         firstChunk.vel.x = firstChunk.vel.x * 0.8f;
     }
     if (Submersion > 0.5f && room.abstractRoom.creatures.Count > 0 && grabbedBy.Count == 0)
     {
         AbstractCreature abstractCreature = room.abstractRoom.creatures[UnityEngine.Random.Range(0, room.abstractRoom.creatures.Count)];
         if (abstractCreature.creatureTemplate.type == CreatureTemplate.Type.JetFish && abstractCreature.realizedCreature != null && !abstractCreature.realizedCreature.dead && (abstractCreature.realizedCreature as JetFish).AI.goToFood == null && (abstractCreature.realizedCreature as JetFish).AI.WantToEatObject(this))
         {
             (abstractCreature.realizedCreature as JetFish).AI.goToFood = this;
         }
     }
 }
Beispiel #2
0
    public LightWorm(AbstractCreature abstractCreature, World world) : base(abstractCreature, world)
    {
        bodyChunks    = new BodyChunk[2];
        bodyChunks[0] = new BodyChunk(this, 0, new Vector2(0f, 0f), 8f, 0.05f);
        bodyChunks[1] = new BodyChunk(this, 0, new Vector2(0f, 0f), 8f, 0.05f);
        bodyChunks[0].rotationChunk      = bodyChunks[1];
        bodyChunks[1].collideWithTerrain = false;
        bodyChunkConnections             = new PhysicalObject.BodyChunkConnection[0];

        tentacle         = new Tentacle(this, bodyChunks[1], 400f * bodySize);
        tentacle.tProps  = new Tentacle.TentacleProps(false, false, true, 0.5f, 0f, 1.4f, 0f, 0f, 1.2f, 10f, 0.25f, 5f, 15, 60, 12, 0);
        tentacle.tChunks = new Tentacle.TentacleChunk[(int)(15f * Mathf.Lerp(bodySize, 1f, 0.5f))];
        for (int i = 0; i < tentacle.tChunks.Length; i++)
        {
            tentacle.tChunks[i] = new Tentacle.TentacleChunk(tentacle, i, (float)(i + 1) / (float)tentacle.tChunks.Length, 2f * Mathf.Lerp(bodySize, 1f, 0.5f));
        }
        tentacle.stretchAndSqueeze = 0.1f;

        GoThroughFloors = true;
        airFriction     = 0.99f;
        gravity         = 0.9f;
        bounce          = 0.1f;
        surfaceFriction = 0.47f;
        collisionLayer  = 1;
        waterFriction   = 0.92f;
        buoyancy        = 0.95f;
        extended        = 1f;
        retractSpeed    = 1f;
        lastExtended    = true;
    }
Beispiel #3
0
 public FeedAction(AbstractCreature _target, DamageInfo _info, int _maxHpAmount)
 {
     info = _info;
     SetValues(_target, _info);
     increaseHpAmount = _maxHpAmount;
     GameActionType   = ActionType.Damage;
 }
Beispiel #4
0
        /// <summary>
        /// Checks if the region has albino leviathans configured
        /// </summary>
        private static void BigEel_ctor(On.BigEel.orig_ctor orig, BigEel self, AbstractCreature abstractCreature, World world)
        {
            orig(self, abstractCreature, world);

            if (world != null && !world.singleRoomWorld && world.region != null)
            {
                foreach (KeyValuePair <string, string> keyValues in CustomWorldMod.activatedPacks)
                {
                    if (CustomWorldMod.installedPacks[keyValues.Key].regionConfig.TryGetValue(world.region.name,
                                                                                              out CustomWorldStructs.RegionConfiguration config))
                    {
                        if (config.albinoLevi)
                        {
                            CustomWorldMod.Log($"Albino leviathan in [{world.region.name}] from [{CustomWorldMod.installedPacks[keyValues.Key].name}]",
                                               false, CustomWorldMod.DebugLevel.FULL);
                            self.albino = true;
                            self.iVars.patternColorB     = new HSLColor(0f, 0.6f, 0.75f);
                            self.iVars.patternColorA.hue = 0.5f;
                            self.iVars.patternColorA     = HSLColor.Lerp(self.iVars.patternColorA, new HSLColor(0.97f, 0.8f, 0.75f), 0.9f);
                            break;
                        }
                    }
                }
            }
        }
Beispiel #5
0
 public NoDrawPower(AbstractCreature _owner)
 {
     name        = Name;
     Owner       = _owner;
     Amount      = -1;
     Description = Descriptions[0];
 }
Beispiel #6
0
 protected void SetValues(AbstractCreature _target, AbstractCreature _source)
 {
     Target   = _target;
     Source   = _source;
     Amount   = 0;
     Duration = 0.5f;
 }
Beispiel #7
0
 public FiendFireAction(AbstractCreature _target, DamageInfo _info)
 {
     damageInfo = _info;
     SetValues(_target, _info);
     GameActionType   = ActionType.Wait;
     GameAttackEffect = AttackEffect.Fire;
 }
Beispiel #8
0
 private static void NotifyObservers(AbstractCreature creature)
 {
     foreach (var observer in _observers)
     {
         observer.Notify(creature);
     }
 }
        private static void SendNootArmy()
        {
            Game game = new Game();
            //Thank you Lee.
            AbstractRoom adjacentRoom;
            int          numOfNoodles = 20;

            Debug.Log("RELEASE THE NOOTS!");
            for (int i = 0; i < game.player.room.exitAndDenIndex.Length; i++)
            {
                if (game.player.room.WhichRoomDoesThisExitLeadTo(game.player.room.exitAndDenIndex[i]) != null)
                {
                    adjacentRoom = game.player.room.WhichRoomDoesThisExitLeadTo(game.player.room.exitAndDenIndex[i]);
                    WorldCoordinate node = adjacentRoom.RandomNodeInRoom();
                    if (adjacentRoom.realizedRoom == null)
                    {
                        adjacentRoom.RealizeRoom(game.player.room.world, game.player.room.world.game);
                    }
                    for (int c = 0; c < numOfNoodles; c++)
                    {
                        Debug.Log("Spawned a Noodle Fly");
                        AbstractCreature abstractNoodle = new AbstractCreature(game.player.room.world, StaticWorld.GetCreatureTemplate(CreatureTemplate.Type.BigNeedleWorm), null, node, adjacentRoom.world.game.GetNewID());
                        adjacentRoom.AddEntity(abstractNoodle);
                        abstractNoodle.RealizeInRoom();
                        abstractNoodle.state.socialMemory.GetOrInitiateRelationship(game.player.abstractCreature.ID).like     = -50f;
                        abstractNoodle.state.socialMemory.GetOrInitiateRelationship(game.player.abstractCreature.ID).tempLike = -50f;
                        abstractNoodle.abstractAI.InternalSetDestination(game.player.coord);
                    }
                    break;
                }
            }
        }
 protected virtual void DrawEverything(ref AbstractCreature player)
 {
     DrawEdges(ref _world.WorldPlayGround);
     DrawGround(ref _world.WorldPlayGround);
     DrawItemsOnTheGround(ref _world.WorldPlayGround);
     DrawCreature(ref _world.WorldPlayGround, ref player);
 }
Beispiel #11
0
 public DualWieldAction(AbstractCreature _source, int _amount)
 {
     SetValues(AbstractDungeon.Player, _source, _amount);
     GameActionType = ActionType.Draw;
     player         = AbstractDungeon.Player;
     dupeAmount     = _amount;
 }
Beispiel #12
0
 public override void SpawnCreatures()
 {
     base.SpawnCreatures();
     if (this.PlayMode)
     {
         int num = -1;
         List <SandboxEditor.PlacedIconData> list = SandboxEditor.LoadConfiguration(ref num, this.arenaSitting.GetCurrentLevel);
         for (int i = 0; i < list.Count; i++)
         {
             this.SpawnEntity(list[i]);
         }
     }
     else
     {
         bool flag = false;
         if (this.arenaSitting.players.Count < 1)
         {
             flag = true;
             this.arenaSitting.players.Add(new ArenaSitting.ArenaPlayer(0));
         }
         for (int j = 0; j < this.arenaSitting.players.Count; j++)
         {
             AbstractCreature abstractCreature = new AbstractCreature(this.game.world, StaticWorld.GetCreatureTemplate(CreatureTemplate.Type.Overseer), null, new WorldCoordinate(0, 0, -50, 0), this.game.GetNewID());
             this.game.world.GetAbstractRoom(0).AddEntity(abstractCreature);
             abstractCreature.abstractAI.SetDestinationNoPathing(new WorldCoordinate(0, -1, -1, UnityEngine.Random.Range(0, this.game.world.GetAbstractRoom(0).nodes.Length)), true);
             (abstractCreature.abstractAI as OverseerAbstractAI).ownerIterator = 10 + this.arenaSitting.players[j].playerNumber;
         }
         if (flag)
         {
             this.arenaSitting.players.Clear();
         }
     }
 }
Beispiel #13
0
        public override void Execute()
        {
            AbstractCreature actor       = Actor;
            MapBlock         targetBlock = actor.Position.NextBlock(Direction);

            // check that something to attack exists in this direction
            if (!actor.Position.EntranceInDirection(Direction).IsOpen() || targetBlock == null)
            {
                throw new MapBlockInDirectionNotAccessibleException(actor, Direction);
            }
            if (!targetBlock.Occupied)
            {
                throw new CantAttackInThisDirectionException(actor, Direction);
            }

            // calculate attack
            AbstractCreature targetCreature = targetBlock.Creature;
            double           totalAttack    = actor.TotalAttack;
            double           totalDeffense  = targetCreature.TotalDeffense;
            double           totalDamage    = Math.Max(0, totalAttack - totalDeffense);


            // perform attack
            targetCreature.TakeDamage(totalDamage);
        }
Beispiel #14
0
 public BarricadePower(AbstractCreature _owner)
 {
     name  = Name;
     ID    = "Barricade";
     Owner = _owner;
     UpdateDescription();
 }
Beispiel #15
0
    private void triggerPassiveEffect(DamageInfo _info, bool _isHitAll)
    {
        AbstractMonster tMonster;

        if (!_isHitAll)
        {
            AbstractCreature tCreature = AbstractDungeon.GetRandomMonster();
            for (int i = 0; i < AbstractDungeon.GetMonsters().Monsters.Count; i++)
            {
                tMonster = AbstractDungeon.GetMonsters().Monsters[i];
                if (tMonster.IsHasPower("Lockon") && !tMonster.IsDeadOrEscaped())
                {
                    tCreature = tMonster;
                    break;
                }
            }

            if (null != tCreature)
            {
            }
            AbstractDungeon.ActionManager.AddToBottom(new DamageAction(tCreature, _info, AttackEffect.None, true));
        }
        else
        {
            //AbstractDungeon.ActionManager.AddToBottom(new DamageAllEnemiesAction(AbstractDungeon.Player,));
        }
    }
Beispiel #16
0
 public SunderAction(AbstractCreature _target, DamageInfo _info, int _energyAmount)
 {
     info = _info;
     SetValues(_target, _info);
     energyAmount   = _energyAmount;
     GameActionType = ActionType.Damage;
 }
Beispiel #17
0
 protected void SetValues(AbstractCreature _target, DamageInfo _info)
 {
     Target   = _target;
     Source   = _info.Owner;
     Amount   = _info.Output;
     Duration = 0.5f;
 }
Beispiel #18
0
        /// <summary>
        /// Renders creature as a path.
        /// </summary>
        /// <param name="creature">Creature to be rendered.</param>
        /// <param name="x">Top left corner x-coordinate of map block.</param>
        /// <param name="y">Top left corner y-coordinate of map block.</param>
        /// <param name="blockSize">Size of the map block.</param>
        /// <returns></returns>
        private Path RenderCreature(AbstractCreature creature, double x, double y, double blockSize)
        {
            // don't render dead creatures
            if (!creature.Alive)
            {
                return(new Path());
            }

            if (creature is HumanPlayer)
            {
                return(RenderHumanPlayer((AbstractPlayer)creature, x, y, blockSize));
            }
            else if (creature is AbstractPlayer)
            {
                return(RenderAIPlayer((AbstractPlayer)creature, x, y, blockSize));
            }
            else if (creature is Monster)
            {
                return(RenderMonster((Monster)creature, x, y, blockSize));
            }
            else
            {
                return(new Path());
            }
        }
Beispiel #19
0
    public void ApplyEnemyPowersOnly(AbstractCreature _target)
    {
        Output     = Base;
        IsModified = false;
        float         tValue = Output;
        AbstractPower tPower;

        for (int i = 0; i < _target.powers.Count; i++)
        {
            tPower = _target.powers[i];
            tValue = tPower.AtDamageReceive(Output, Type);
            if (Base != Output)
            {
                IsModified = true;
            }
        }

        for (int i = 0; i < _target.powers.Count; i++)
        {
            tPower = _target.powers[i];
            tValue = tPower.AtDamageFinalReceive(Output, Type);
            if (Base != Output)
            {
                IsModified = true;
            }
        }

        if (tValue < 0f)
        {
            tValue = 0f;
        }

        Output = (int)Mathf.Floor(tValue);
    }
 // Token: 0x06001C19 RID: 7193 RVA: 0x00191098 File Offset: 0x0018F298
 public WalkerBeastAI(AbstractCreature creature, World world) : base(creature, world)
 {
     WalkerBeast    = (creature.realizedCreature as WalkerBeast);
     WalkerBeast.AI = this;
     AddModule(new WalkerBeastPather(this, world, creature));
     pathFinder.accessibilityStepsPerFrame = 60;
     pathFinder.stepsPerFrame = 30;
     AddModule(new Tracker(this, 10, 5, 250, 0.5f, 5, 5, 20));
     AddModule(new PreyTracker(this, 5, 1f, 10f, 25f, 0.95f));
     AddModule(new RainTracker(this));
     AddModule(new DenFinder(this, creature));
     AddModule(new StuckTracker(this, true, false));
     AddModule(new RelationshipTracker(this, tracker));
     AddModule(new ThreatTracker(this, 3));
     AddModule(new UtilityComparer(this));
     stuckTracker.checkPastPositionsFrom    = 0;
     stuckTracker.totalTrackedLastPositions = 40;
     stuckTracker.pastStuckPositionsCloseToIncrementStuckCounter = 35;
     stuckTracker.minStuckCounter          = 140;
     stuckTracker.maxStuckCounter          = 240;
     stuckTracker.goalSatisfactionDistance = 7;
     stuckTracker.AddSubModule(new StuckTracker.GetUnstuckPosCalculator(stuckTracker));
     utilityComparer.AddComparedModule(threatTracker, null, 0.9f, 1.1f);
     utilityComparer.AddComparedModule(preyTracker, null, 0.5f, 1.1f);
     utilityComparer.AddComparedModule(rainTracker, null, 0.9f, 1.1f);
     utilityComparer.AddComparedModule(stuckTracker, null, 1f, 1.1f);
     behavior       = Behavior.Idle;
     creatureLooker = new CreatureLooker(this, tracker, creature.realizedCreature, 0.0025f, 30);
 }
    public SeaDrakeAI(AbstractCreature creature, World world) : base(creature, world)
    {
        this.fish    = (creature.realizedCreature as SeaDrake);
        this.fish.AI = this;
        base.AddModule(new FishPather(this, world, creature));
        base.AddModule(new Tracker(this, 10, 10, 250, 0.5f, 5, 5, 20));


        base.AddModule(new NoiseTracker(this, base.tracker));
        base.noiseTracker.forgetTime       = 320;
        base.noiseTracker.hearingSkill     = 5f;
        base.noiseTracker.ignoreSeenNoises = false;

        base.AddModule(new PreyTracker(this, 5, 1f, 50f, 250f, 0.05f));
        base.AddModule(new ThreatTracker(this, 3));
        base.AddModule(new RainTracker(this));
        base.AddModule(new DenFinder(this, creature));
        base.AddModule(new RelationshipTracker(this, base.tracker));
        base.AddModule(new UtilityComparer(this));
        base.AddModule(new StuckTracker(this, true, false));
        base.stuckTracker.AddSubModule(new StuckTracker.GetUnstuckPosCalculator(base.stuckTracker));
        base.stuckTracker.AddSubModule(new StuckTracker.StuckCloseToShortcutModule(base.stuckTracker));
        base.utilityComparer.AddComparedModule(base.threatTracker, null, 1f, 1.1f);
        base.utilityComparer.AddComparedModule(base.preyTracker, null, 2f, 1.1f);
        base.utilityComparer.AddComparedModule(base.noiseTracker, null, 1.5f, 1.1f);
        base.utilityComparer.AddComparedModule(base.rainTracker, null, 2f, 1.1f);
        base.utilityComparer.AddComparedModule(base.stuckTracker, null, 1f, 1.1f);
        this.behavior = SeaDrakeAI.Behavior.Idle;
    }
 public WalkerBeastAbstractAI(World world, AbstractCreature parent) : base(world, parent)
 {
     lastRoom     = parent.pos.room;
     allowedNodes = new List <WorldCoordinate>();
     if (world.singleRoomWorld)
     {
         for (int i = 0; i < world.GetAbstractRoom(0).nodes.Length; i++)
         {
             if (world.GetAbstractRoom(0).nodes[i].type == AbstractRoomNode.Type.SideExit && world.GetAbstractRoom(0).nodes[i].entranceWidth >= 5)
             {
                 allowedNodes.Add(new WorldCoordinate(0, -1, -1, i));
             }
         }
     }
     else
     {
         for (int j = 0; j < WalkerBeastAbstractAI.UGLYHARDCODEDALLOWEDROOMS.Length; j++)
         {
             if (world.GetAbstractRoom(WalkerBeastAbstractAI.UGLYHARDCODEDALLOWEDROOMS[j]) != null)
             {
                 int index = world.GetAbstractRoom(WalkerBeastAbstractAI.UGLYHARDCODEDALLOWEDROOMS[j]).index;
                 for (int k = 0; k < world.GetAbstractRoom(index).nodes.Length; k++)
                 {
                     if (world.GetAbstractRoom(index).nodes[k].type == AbstractRoomNode.Type.SideExit && world.GetAbstractRoom(index).nodes[k].entranceWidth >= 2)
                     {
                         allowedNodes.Add(new WorldCoordinate(index, -1, -1, k));
                         Debug.Log("UGLY HARD CODE ALLOWED ROOMS: " + index + ", " + k);
                     }
                 }
             }
         }
     }
 }
Beispiel #23
0
    IEnumerator DoTurn(AbstractCreature combatant)
    {
        // get list of valid targets for combatant
        List <AbstractCreature> targetList;

        if (combatant.CompareTag("Player"))
        {
            targetList = nonplayers;
        }
        else
        {
            targetList = players;
        }

        // if no valid targets then combat should end
        HasWon(combatant, targetList);

        combatant.StartTurn();
        yield return(StartCoroutine(combatant.PerformTurn(targetList)));

        // kill any dead targets
        targetList.FindAll((target) =>
        {
            return(target.IsDead());
        }).ForEach((d) =>
        {
            targetList.Remove(d);
            d.OnDeath();
        });

        HasWon(combatant, targetList);
        turnCount = (turnCount + 1) % combatants.Count;
        yield return(null);
    }
Beispiel #24
0
 public PutOnButtomOfDeckAction(AbstractCreature _target, AbstractCreature _source, int _amount, bool _isRandom)
 {
     Target = _target;
     player = _target as AbstractPlayer;
     SetValues(_target, _source, _amount);
     GameActionType = ActionType.CardManipulation;
 }
Beispiel #25
0
 public DamageInfo(AbstractCreature _damageSource, int _base, DamageType _type)
 {
     IsModified = false;
     Owner      = _damageSource;
     Base       = _base;
     Type       = _type;
     Output     = _base;
 }
Beispiel #26
0
 public BrutalityPower(AbstractCreature _owner, int _drawAmount)
 {
     name   = Name;
     ID     = "Brutality";
     Owner  = _owner;
     Amount = _drawAmount;
     UpdateDescription();
 }
 /// <summary>
 /// Use method sets the boolean value StrengthBoost to true.
 /// </summary>
 /// <param name="creature">The creature to receive the boost, which will only be the player for now.</param>
 public override void Use(AbstractCreature creature)
 {
     if (creature.Inventory.Contains(this))
     {
         creature.StrengthBoost = true;
         creature.Inventory.Remove(this);
     }
 }
Beispiel #28
0
 public LoseStrengthPower(AbstractCreature _owner, int _amount)
 {
     name   = Name;
     ID     = "Flex";
     Owner  = _owner;
     Amount = _amount;
     UpdateDescription();
 }
Beispiel #29
0
 public DoubleTapPower(AbstractCreature _owner, int _amount)
 {
     name   = Name;
     ID     = "DoubleTap";
     Owner  = _owner;
     Amount = _amount;
     UpdateDescription();
 }
Beispiel #30
0
 public DarkEmbracePower(AbstractCreature _owner, int _amount)
 {
     name   = Name;
     ID     = "DarkEmbrace";
     Owner  = _owner;
     Amount = _amount;
     UpdateDescription();
 }