示例#1
0
 public EnemyDescription(EnemyCodex.EnemyTypes p_enType, EnemyDescription.Category p_enCategory, string p_sFullname, int p_iLevel, int p_iMaxHealth)
 {
     this.sFullName = p_sFullname;
     this.iLevel = p_iLevel;
     this.iMaxHealth = p_iMaxHealth;
     this.enType = p_enType;
     this.enCategory = p_enCategory;
 }
示例#2
0
 public CardWatcher(PlayerEntity xTarget, Vector2 v2Lol, EnemyCodex.EnemyTypes enType)
 {
     this.xTransform = new TransformComponent(v2Lol);
     this.xTargetEntity = xTarget;
     Vector2 v2Dir = v2Lol - this.xTargetEntity.xTransform.v2Pos;
     this.enEnemyType = enType;
     v2Dir.Normalize();
     this.v2CurDir = v2Dir;
     this.fRotAdd = 0.01f + (float)Program.GetTheGame().randomInLogic.NextDouble() * 0.025f;
     this.fVelocity = (float)Program.GetTheGame().randomInLogic.NextDouble() * 1f + 3f;
     if (Program.GetTheGame().randomInLogic.Next(2) == 0)
     {
         this.iRotDir = 1;
     }
     else
     {
         this.iRotDir = -1;
     }
     ContentManager Content = Program.GetTheGame().Content;
     this.xRenderComponent = new AnimatedRenderComponent(this);
     this.xRenderComponent.dixAnimations[0] = new Animation(0, 0, Content.Load<Texture2D>("Items/Card/Card"), new Vector2(7f, 7f), 1, 12, 15, 15, 0, 0, 30, Animation.LoopSettings.Looping, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[]
     {
         new AnimationInstruction(new AnimInsCriteria(AnimInsCriteria.Criteria.TriggerAlwaysAfterXTicks, new float[]
         {
             20f
         }), new AnimInsEvent(AnimInsEvent.EventType.ChangeTimeWarp, new float[]
         {
             0.975f
         })),
         new AnimationInstruction(new AnimInsCriteria(AnimInsCriteria.Criteria.TriggerOnceAfterXTicks, new float[]
         {
             54f
         }), new AnimInsEvent(AnimInsEvent.EventType.PlayAnimation, new float[]
         {
             1f
         }))
     });
     this.xRenderComponent.dixAnimations[1] = new Animation(1, 0, Content.Load<Texture2D>("Items/Card/Card"), new Vector2(7f, 7f), 8, 1, 15, 15, 0, 0, 30, Animation.LoopSettings.Looping, Animation.CancelOptions.IgnoreIfPlaying, true, true, new AnimationInstruction[0]);
     this.xRenderComponent.dixAnimations[1].enSpriteEffect = SpriteEffects.FlipHorizontally;
     this.xRenderComponent.xTransform = this.xTransform;
     this.xRenderComponent.fVirtualHeight = this.xTargetEntity.xRenderComponent.fVirtualHeight;
     this.xRenderComponent.v2OffsetRenderPos = new Vector2(0f, -15f);
     Program.GetTheGame().xRenderMaster.RegisterAboveSorted(this.xRenderComponent);
     Program.GetTheGame()._EffectMaster_AddEffect(new SortedAnimated(this.xTransform.v2Pos, SortedAnimated.SortedAnimatedEffects.Card_Appear));
 }
示例#3
0
        //
        // Harmony Library Patches
        //

        /// <summary> Patches GetEnemyInstance so that SoG can create modded enemy instances. </summary>
        private static bool GetEnemyInstance_PrefixPatch(ref Enemy __result, EnemyCodex.EnemyTypes enType, Level.WorldRegion enOverrideContent)
        {
            if (!enType.IsModEnemy())
            {
                return(true); // Executes original method
            }

            EnemyDescription xDesc = EnemyCodex.denxDescriptionDict[enType];

            __result = new Enemy()
            {
                xEnemyDescription = xDesc,
                enType            = enType
            };

            __result.xRenderComponent.xOwnerObject = __result;

            ModEnemyData xModData = ModLibrary.EnemyDetails[enType];

            xModData.InstanceBuilder?.Invoke(__result);

            __result.xBaseStats.iLevel = __result.xEnemyDescription.iLevel;
            __result.xBaseStats.iHP    = (__result.xBaseStats.iBaseMaxHP = __result.xEnemyDescription.iMaxHealth);
            if (__result.xEnemyDescription.enCategory == EnemyDescription.Category.Regular)
            {
                __result.rcRegularHPRenderComponent = new RegularEnemyHPRenderComponent(__result);
            }
            __result.xRenderComponent.bReSortHeight = true;
            __result.xRenderComponent.GetCurrentAnimation().Reset();
            foreach (DropChance xDrop in __result.xEnemyDescription.lxLootTable)
            {
                __result.lxLootTable.Add(new DropChance(xDrop.iChance, xDrop.enItemToDrop, xDrop.iRolls));
                ItemCodex.GetItemDescription(xDrop.enItemToDrop);
            }

            return(false); // Skips original method
        }
示例#4
0
 public MultipleKillQuest(string name, string summary, int level, Action <Player> reward, EnemyCodex.EnemyTypes enemiesToKill) : base(name, summary, level, reward)
 {
     EnemiesToKill = enemiesToKill;
 }
示例#5
0
 public static bool IsModEnemy(this EnemyCodex.EnemyTypes enType)
 {
     return(enType >= ModLibrary.EnemyTypesStart && enType < ModLibrary.EnemyTypesNext);
 }
示例#6
0
        // EnemyTypes extensions

        public static bool IsSoGEnemy(this EnemyCodex.EnemyTypes enType)
        {
            return(Enum.IsDefined(typeof(EnemyCodex.EnemyTypes), enType));
        }
示例#7
0
 public ModEnemyData(EnemyCodex.EnemyTypes enType)
 {
     this.enType = enType;
 }
示例#8
0
		public StartBossNameFlash(EnemyCodex.EnemyTypes enType)
		{
			this.enEnemyType = enType;
		}
示例#9
0
 public EnemyChancePair(int iChance, EnemyCodex.EnemyTypes enType)
 {
     this.iChance = iChance;
     this.enType = enType;
 }
 public override void Update()
 {
     if (this.iEncounterStage == 15)
     {
         if (this.xPublicEnemy.bToBeDestroyed)
         {
             Program.game._EntityMaster_AddWatcher(new CardWatcher(Program.game.xLocalPlayer.xEntity, this.xPublicEnemy.xTransform.v2Pos, EnemyCodex.EnemyTypes.GreenSlime));
             this.iEncounterStage = 30;
         }
         if (Program.game.xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client)
         {
             PlayerView xMain = Program.game.xGameSessionData.xMainCharacter;
             if ((xMain.xEntity.xRenderComponent.iActiveAnimation >= 200 && xMain.xEntity.xRenderComponent.GetCurrentAnimation().iRenderedFrame >= 6) || (xMain.xEntity.xRenderComponent.iActiveAnimation >= 100 && xMain.xEntity.xRenderComponent.GetCurrentAnimation().iRenderedFrame > 2))
             {
                 Program.game._Enemy_TakeDamage(this.xPublicEnemy, 8, 0, null);
                 Program.game._EntityMaster_DestroyEnemy(this.xPublicEnemy.iID, true, false);
                 this.xPublicEnemy.bToBeDestroyed = true;
             }
         }
         return;
     }
     if (this.iEncounterStage == 14)
     {
         AnimatedRenderComponent expr_126_cp_0 = this.xPublicEnemy.xRenderComponent;
         expr_126_cp_0.v2OffsetRenderPos.Y = expr_126_cp_0.v2OffsetRenderPos.Y + 4f;
         if (this.xPublicEnemy.xRenderComponent.v2OffsetRenderPos.Y > 0f)
         {
             this.xPublicEnemy.xRenderComponent.v2OffsetRenderPos.Y = 0f;
             this.iEncounterStage = 15;
             Program.game.xSoundSystem.PlayCue("GigaSlime_PrisonDestroyed", this.xPublicEnemy.xTransform.v2Pos);
             this.xPublicEnemy.xRenderComponent.SwitchAnimation(0, Animation.CancelOptions.IgnoreIfPlaying);
             Random knark = Program.game.randomInVisual;
             Vector2 v2Orig = this.xPublicEnemy.xTransform.v2Pos;
             Program.game._EntityMaster_AddDynamicEnvironment(DynamicEnvironmentCodex.ObjectTypes.CloudEffect_BossPapaSlime_SlowSlimeSmall, this.xPublicEnemy.xTransform.v2Pos);
             for (int i = 0; i < 6; i++)
             {
                 Vector2 v2RandDir = new Vector2(-1f + (float)knark.NextDouble() * 2f, -1f + (float)knark.NextDouble() * 2f);
                 if (v2RandDir == Vector2.Zero)
                 {
                     v2RandDir = new Vector2(1f, 0f);
                 }
                 v2RandDir.Normalize();
                 float fRandGrade = (float)knark.NextDouble();
                 SortedAnimated eff = Program.game._EffectMaster_AddEffect(new _Effect_MovingAnimated(v2Orig, SortedAnimated.SortedAnimatedEffects._HitEffect_SlimeParticle, v2RandDir * (0.5f + (float)Program.game.randomInVisual.NextDouble() * 2f), 35 + (int)(25f * fRandGrade), 25, 0.9f)) as SortedAnimated;
                 (eff.xRenderComponent as AnimatedRenderComponent).fAnimationTimeWarp = 0.7f + fRandGrade * 0.6f;
             }
         }
     }
     else if (this.iEncounterStage == 16)
     {
         Random knark2 = Program.game.randomInVisual;
         if (this.iCounter % 2 == 0)
         {
             SortedAnimated xAdd = Program.game._EffectMaster_AddEffect(new SortedAnimated(new Vector2((float)knark2.Next(630), -10f), SortedAnimated.SortedAnimatedEffects.Confetti01)) as SortedAnimated;
             this.lxConfettiLol.Add(xAdd);
         }
         for (int j = 0; j < this.lxConfettiLol.Count; j++)
         {
             TransformComponent expr_34A_cp_0 = this.lxConfettiLol[j].xTransform;
             expr_34A_cp_0.v2Pos.X = expr_34A_cp_0.v2Pos.X + 0.5f;
             TransformComponent expr_372_cp_0 = this.lxConfettiLol[j].xTransform;
             expr_372_cp_0.v2Pos.Y = expr_372_cp_0.v2Pos.Y + 1f;
         }
     }
     if (Program.game.xNetworkInfo.enCurrentRole == NetworkHelperInterface.NetworkRole.Client)
     {
         return;
     }
     if (this.iEncounterStage < 0)
     {
         return;
     }
     this.iCounter++;
     if (this.iEncounterStage == 0)
     {
         if (this.iCounter < 120)
         {
             return;
         }
         if (this.iCounter == 120)
         {
             this.OpenLeftDoor();
             this.OpenRightDoor();
             this.OpenTopDoor();
             base.SendNetworkInstruction(0, new float[0]);
             this.master.xCollisionMaster.RegisterStaticCollider(new BoxCollider(new Rectangle(247, 302, 56, 23), MathHelper.ToRadians(-44f)));
         }
         int iInterval = 230 - 30 * Program.game.dixPlayers.Count;
         if (this.iCounter % iInterval == 0)
         {
             this.SpawnEnemy(EnemyCodex.EnemyTypes.GreenSlime, this.v2SpawnLeft, new Vector2(351f, 341f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))));
         }
         if ((this.iCounter - 10) % iInterval == 0)
         {
             this.SpawnEnemy(EnemyCodex.EnemyTypes.GreenSlime, this.v2SpawnTop, new Vector2(516f, 295f) + new Vector2((float)(-40 + this.master.randomInLogic.Next(80)), (float)(-20 + this.master.randomInLogic.Next(40))));
         }
         if ((this.iCounter - 20) % iInterval == 0)
         {
             this.SpawnEnemy(EnemyCodex.EnemyTypes.GreenSlime, this.v2SpawnRight, new Vector2(674f, 347f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))));
         }
         if (this.iMonstersSpawned >= 5 + 5 * Program.game.dixPlayers.Count)
         {
             this.iEncounterStage = 1;
             this.iCounter = 0;
             return;
         }
     }
     else if (this.iEncounterStage == 1)
     {
         this.iCounter++;
         if (this.iCounter == 60)
         {
             this.CloseRightDoor();
             this.CloseTopDoor();
             this.CloseLeftDoor();
             base.SendNetworkInstruction(1, new float[0]);
             return;
         }
         if (this.iCounter >= 120 && this.master.xEntityMaster.lxActiveEnemies.Count == 1)
         {
             this.OpenLeftDoor();
             this.OpenRightDoor();
             this.OpenTopDoor();
             base.SendNetworkInstruction(0, new float[0]);
             this.iEncounterStage = 2;
             this.iCounter = 0;
             this.iMonstersSpawned = 0;
             return;
         }
     }
     else if (this.iEncounterStage == 2)
     {
         int iPC = Program.game.dixPlayers.Count;
         int iInterval2 = 190 - 30 * iPC;
         if ((this.iCounter + 10) % iInterval2 == 0)
         {
             Vector2 arg_6CF_1 = this.v2SpawnLeft;
             Vector2 arg_6CF_2 = new Vector2(351f, 341f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60)));
             EnemyCodex.EnemyTypes[] array = new EnemyCodex.EnemyTypes[2];
             array[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_6CF_1, arg_6CF_2, array);
         }
         if ((this.iCounter + 20) % iInterval2 == 0)
         {
             Vector2 arg_73E_1 = this.v2SpawnTop;
             Vector2 arg_73E_2 = new Vector2(516f, 295f) + new Vector2((float)(-40 + this.master.randomInLogic.Next(80)), (float)(-20 + this.master.randomInLogic.Next(40)));
             EnemyCodex.EnemyTypes[] array2 = new EnemyCodex.EnemyTypes[2];
             array2[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_73E_1, arg_73E_2, array2);
         }
         if (this.iCounter % iInterval2 == 0)
         {
             Vector2 arg_7AA_1 = this.v2SpawnRight;
             Vector2 arg_7AA_2 = new Vector2(674f, 347f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60)));
             EnemyCodex.EnemyTypes[] array3 = new EnemyCodex.EnemyTypes[2];
             array3[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_7AA_1, arg_7AA_2, array3);
         }
         if (this.iMonstersSpawned >= 10 + 5 * Program.game.dixPlayers.Count)
         {
             this.iEncounterStage = 3;
             this.iCounter = 0;
             return;
         }
     }
     else if (this.iEncounterStage == 3)
     {
         this.iCounter++;
         if (this.iCounter == 60)
         {
             this.CloseRightDoor();
             this.CloseTopDoor();
             this.CloseLeftDoor();
             base.SendNetworkInstruction(1, new float[0]);
             return;
         }
         if (this.iCounter >= 120 && this.master.xEntityMaster.lxActiveEnemies.Count == 1)
         {
             this.OpenLeftDoor();
             this.OpenRightDoor();
             this.OpenTopDoor();
             base.SendNetworkInstruction(0, new float[0]);
             this.iEncounterStage = 4;
             this.iCounter = 0;
             this.iMonstersSpawned = 0;
             this.SpawnEnemy(EnemyCodex.EnemyTypes.Blomma, new Vector2(426f, 378f), Vector2.Zero);
             this.SpawnEnemy(EnemyCodex.EnemyTypes.Blomma, new Vector2(577f, 382f), Vector2.Zero);
             return;
         }
     }
     else if (this.iEncounterStage == 4)
     {
         int iPC2 = Program.game.dixPlayers.Count;
         int iInterval3 = 160 - 20 * iPC2;
         if (iPC2 > 2 && this.iCounter % (iInterval3 * 3) == 0)
         {
             this.SpawnEnemy(this.v2SpawnLeft, new Vector2(351f, 341f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))), new EnemyCodex.EnemyTypes[]
             {
                 EnemyCodex.EnemyTypes.Bee
             });
             this.SpawnEnemy(this.v2SpawnTop, new Vector2(516f, 295f) + new Vector2((float)(-40 + this.master.randomInLogic.Next(80)), (float)(-20 + this.master.randomInLogic.Next(40))), new EnemyCodex.EnemyTypes[]
             {
                 EnemyCodex.EnemyTypes.Bee
             });
             this.SpawnEnemy(this.v2SpawnRight, new Vector2(674f, 347f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))), new EnemyCodex.EnemyTypes[]
             {
                 EnemyCodex.EnemyTypes.Bee
             });
         }
         if ((this.iCounter + 10) % iInterval3 == 0)
         {
             Vector2 arg_A85_1 = this.v2SpawnLeft;
             Vector2 arg_A85_2 = new Vector2(351f, 341f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60)));
             EnemyCodex.EnemyTypes[] array4 = new EnemyCodex.EnemyTypes[2];
             array4[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_A85_1, arg_A85_2, array4);
         }
         if ((this.iCounter + 20) % iInterval3 == 0)
         {
             Vector2 arg_AF4_1 = this.v2SpawnTop;
             Vector2 arg_AF4_2 = new Vector2(516f, 295f) + new Vector2((float)(-40 + this.master.randomInLogic.Next(80)), (float)(-20 + this.master.randomInLogic.Next(40)));
             EnemyCodex.EnemyTypes[] array5 = new EnemyCodex.EnemyTypes[2];
             array5[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_AF4_1, arg_AF4_2, array5);
         }
         if (this.iCounter % iInterval3 == 0)
         {
             Vector2 arg_B60_1 = this.v2SpawnRight;
             Vector2 arg_B60_2 = new Vector2(674f, 347f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60)));
             EnemyCodex.EnemyTypes[] array6 = new EnemyCodex.EnemyTypes[2];
             array6[0] = EnemyCodex.EnemyTypes.Rabbi;
             this.SpawnEnemy(arg_B60_1, arg_B60_2, array6);
         }
         if (this.iCounter % 300 == 0)
         {
             if (this.iMonstersSpawned % 3 == 0)
             {
                 this.SpawnEnemy(this.v2SpawnLeft, new Vector2(351f, 341f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))), new EnemyCodex.EnemyTypes[]
                 {
                     EnemyCodex.EnemyTypes.Bee
                 });
             }
             else if (this.iMonstersSpawned % 3 == 1)
             {
                 this.SpawnEnemy(this.v2SpawnTop, new Vector2(516f, 295f) + new Vector2((float)(-40 + this.master.randomInLogic.Next(80)), (float)(-20 + this.master.randomInLogic.Next(40))), new EnemyCodex.EnemyTypes[]
                 {
                     EnemyCodex.EnemyTypes.Bee
                 });
             }
             else if (this.iMonstersSpawned % 3 == 2)
             {
                 this.SpawnEnemy(this.v2SpawnRight, new Vector2(674f, 347f) + new Vector2((float)(-20 + this.master.randomInLogic.Next(40)), (float)(-30 + this.master.randomInLogic.Next(60))), new EnemyCodex.EnemyTypes[]
                 {
                     EnemyCodex.EnemyTypes.Bee
                 });
             }
         }
         if (this.iMonstersSpawned >= 20)
         {
             this.iEncounterStage = 5;
             this.iCounter = 0;
             return;
         }
     }
     else if (this.iEncounterStage == 5)
     {
         this.iCounter++;
         if (this.iCounter == 60)
         {
             this.CloseRightDoor();
             this.CloseTopDoor();
             this.CloseLeftDoor();
             base.SendNetworkInstruction(1, new float[0]);
             return;
         }
         if (this.iCounter >= 120 && this.master.xEntityMaster.lxActiveEnemies.Count == 1)
         {
             this.iEncounterStage = 6;
             this.iCounter = 0;
             this.iMonstersSpawned = 0;
             this.master._Trigger_HandleTriggerEvent(FlagCodex.FlagID._MainStory_Trials_AllComplete, 1);
         }
     }
 }
示例#11
0
		public PetDescription(NPCCodex.NPCTypes enNPCType, EnemyCodex.EnemyTypes enEnemyType)
		{
			this.enNPCType = enNPCType;
			this.enEnemyType = enEnemyType;
		}