コード例 #1
0
 public static void CheckItems(Mod mod, Player player, ref int damage, ref float knockBack)
 {
     // Loop throught the accessories of the player.
     for (int i = 3; i < 8 + player.extraAccessorySlots; i++)
     {
         // -50% knockback.
         if (player.armor[i].type == mod.ItemType("TornadoAnklet") || player.armor[i].type == mod.ItemType("HeavyRing"))
             knockBack /= 2;
         else if (player.armor[i].type == mod.ItemType("ReinforcedRing"))
             knockBack -= (knockBack / 5); // 20% less knockback
     }
 }
コード例 #2
0
 public static void AddBossRecipes(Mod mod)
 {
     ModRecipe recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.SuspiciousLookingEye, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.WormFood, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.BloodySpine, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.Abeemination, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.GuideVoodooDoll);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalEye, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalWorm, 20);
     recipe.AddRecipe();
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(null, "BossItem", 10);
     recipe.AddTile(null, "ExampleWorkbench");
     recipe.SetResult(ItemID.MechanicalSkull, 20);
     recipe.AddRecipe();
     // Here we see another way to retrieve type ids from classnames. Useful for those who program in an IDE who wish to avoid spelling mistakes.
     recipe = new ModRecipe(mod);
     recipe.AddIngredient(mod.ItemType<Items.BossItem>(), 10);
     recipe.AddTile(mod.TileType<Tiles.ExampleWorkbench>());
     recipe.SetResult(ItemID.LihzahrdPowerCell, 20);
     recipe.AddRecipe();
 }
コード例 #3
0
 public static bool ChestItemSummonCheck(int x, int y, Mod mod)
 {
     if (Main.netMode == 1)
     {
         return false;
     }
     int num = Chest.FindChest(x, y);
     if (num < 0)
     {
         return false;
     }
     int numberExampleBlocks = 0;
     int numberOtherItems = 0;
     ushort tileType = Main.tile[Main.chest[num].x, Main.chest[num].y].type;
     int tileStyle = (int)(Main.tile[Main.chest[num].x, Main.chest[num].y].frameX / 36);
     if (tileType == TileID.Containers && (tileStyle < 5 || tileStyle > 6))
     {
         for (int i = 0; i < 40; i++)
         {
             if (Main.chest[num].item[i] != null && Main.chest[num].item[i].type > 0)
             {
                 if (Main.chest[num].item[i].type == mod.ItemType("ExampleBlock"))
                 {
                     numberExampleBlocks += Main.chest[num].item[i].stack;
                 }
                 else
                 {
                     numberOtherItems++;
                 }
             }
         }
     }
     if (numberOtherItems == 0 && numberExampleBlocks == 100)
     {
         if (Main.tile[x, y].type == 21)
         {
             if (Main.tile[x, y].frameX % 36 != 0)
             {
                 x--;
             }
             if (Main.tile[x, y].frameY % 36 != 0)
             {
                 y--;
             }
             int number = Chest.FindChest(x, y);
             for (int j = x; j <= x + 1; j++)
             {
                 for (int k = y; k <= y + 1; k++)
                 {
                     if (Main.tile[j, k].type == 21)
                     {
                         Main.tile[j, k].active(false);
                     }
                 }
             }
             for (int l = 0; l < 40; l++)
             {
                 Main.chest[num].item[l] = new Item();
             }
             Chest.DestroyChest(x, y);
             NetMessage.SendData(34, -1, -1, "", 1, (float)x, (float)y, 0f, number, 0, 0);
             NetMessage.SendTileSquare(-1, x, y, 3);
         }
         int npcToSpawn = mod.NPCType("PartyZombie");
         int npcIndex = NPC.NewNPC(x * 16 + 16, y * 16 + 32, npcToSpawn, 0, 0f, 0f, 0f, 0f, 255);
         Main.npc[npcIndex].whoAmI = npcIndex;
         NetMessage.SendData(23, -1, -1, "", npcIndex, 0f, 0f, 0f, 0, 0, 0);
         Main.npc[npcIndex].BigMimicSpawnSmoke();
     }
     return false;
 }