public void Init() { ItemModels = new List <Item>(); foreach (EItemType it in Enum.GetValues(typeof(EItemType))) { if (it != EItemType.None) { ItemModels.Add(Resources.Load <Item>("Items/" + it.ToString())); } } _impacts = StreamingAssetAccessor.FromJson <ImpactsWrapper>(impactsPath); List <KeyValuePair <string, BudgetWorldValues> > pairImpact = FileManager.GenerateList <BudgetWorldValues, ImpactWrap>(_impacts.objects); DicWrapper <BudgetWorldValues> wrapperImpact = FileManager.GenerateDicWrapper(pairImpact); _impactsDatabase = FileManager.GenerateDicFromJson <EWorldImpactType, BudgetWorldValues>(wrapperImpact); foreach (KeyValuePair <EWorldImpactType, BudgetWorldValues> item in _impactsDatabase) { _bonusValues.Add(item.Key, 0); } _budgets = StreamingAssetAccessor.FromJson <BudgetWrapper>(valuesPath); List <KeyValuePair <string, BudgetValues> > pairBudget = FileManager.GenerateList <BudgetValues, BudgetWrap>(_budgets.objects); DicWrapper <BudgetValues> wrapperBudget = FileManager.GenerateDicWrapper(pairBudget); _budgetValues = FileManager.GenerateDicFromJson <EWorldImpactType, BudgetValues>(wrapperBudget); _npcs = StreamingAssetAccessor.FromJson <NPCWrapper>(npcPath); DialogueWrapper dialogueWrapper = StreamingAssetAccessor.FromJson <DialogueWrapper>(dialoguesPath); List <KeyValuePair <string, DialoguePNJ> > dialoguePairs = FileManager.GenerateList <DialoguePNJ, DialogueWrap>(dialogueWrapper.objects); DicWrapper <DialoguePNJ> wrapperDialogue = FileManager.GenerateDicWrapper(dialoguePairs); InteractablePNJ.DialoguesDatabase = FileManager.GenerateDicFromJson(wrapperDialogue); }
public override bool?CanBeHitByProjectile(NPC npc, Projectile projectile) { ProjectileWrapper projectileWrapper = new ProjectileWrapper(projectile); NPCWrapper npcWrapper = new NPCWrapper(npc); Calc.OnHit(projectileWrapper, npcWrapper); return(Calc.CanBeHitBy(projectileWrapper, npcWrapper, base.CanBeHitByProjectile(npc, projectile), false)); }
public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { ProjectileWrapper projectileWrapper = new ProjectileWrapper(projectile); NPCWrapper npcWrapper = new NPCWrapper(npc); Calc.OnHit(projectileWrapper, npcWrapper); Calc.ModifyHitBy(projectileWrapper, npcWrapper, ref damage, ref knockback, ref crit); }
public override bool?CanBeHitByItem(NPC npc, Player player, Item item) { ItemWrapper itemWrapper = new ItemWrapper(item, player); NPCWrapper npcWrapper = new NPCWrapper(npc); Calc.OnHit(itemWrapper, npcWrapper); return(Calc.CanBeHitBy(itemWrapper, npcWrapper, base.CanBeHitByItem(npc, player, item), false)); }
public override void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit) { ItemWrapper itemWrapper = new ItemWrapper(item, player); NPCWrapper npcWrapper = new NPCWrapper(npc); Calc.OnHit(itemWrapper, npcWrapper); Calc.ModifyHitBy(itemWrapper, npcWrapper, ref damage, ref knockback, ref crit); }
public override bool CanBeHitByNPC(NPC npc, ref int cooldownSlot) { NPCWrapper npcWrapper = new NPCWrapper(npc); PlayerWrapper playerWrapper = new PlayerWrapper(player); Calc.OnHit(npcWrapper, playerWrapper); return(Calc.CanBeHitBy(npcWrapper, playerWrapper, base.CanBeHitByNPC(npc, ref cooldownSlot), false)); }
public override bool PreAI(Projectile projectile) { ProjectileWrapper projWrapper = new ProjectileWrapper(projectile); if (projWrapper.GetTeam() == Team.PlayerFriendly || projWrapper.GetTeam() == Team.Unknown) { ClosestTarget closest = ClosestTarget.Null; for (int i = 0; i < Main.maxNPCs; i++) { NPC npc = Main.npc[i]; if (npc != null && npc.active) { NPCWrapper npcWrapper = new NPCWrapper(npc); if (npc.GetGlobalNPC <NPCTyping>().GetAbility().AttractProjectile( new AbilityLookup.AttractProjectileParameters(projWrapper, npcWrapper))) { ClosestTarget newClosest = new ClosestTarget(npc, projectile); if (newClosest.distance < closest.distance) { closest = newClosest; } } } } if (closest.id >= 0) { ProjectileHome(projectile, closest, Main.npc[closest.id].Center); } } else if (projWrapper.GetTeam() == Team.EnemyNPC) { ClosestTarget closest = ClosestTarget.Null; for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; if (player != null && player.active) { PlayerWrapper playerWrapper = new PlayerWrapper(player); if (playerWrapper.GetModPlayer <PlayerTyping>().GetAbility().AttractProjectile( new AbilityLookup.AttractProjectileParameters(projWrapper, playerWrapper))) { ClosestTarget newClosest = new ClosestTarget(player, projectile); if (newClosest.distance < closest.distance) { closest = newClosest; } } } } if (closest.id >= 0) { ProjectileHome(projectile, closest, Main.player[closest.id].Center); } } return(base.PreAI(projectile)); }
public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit) { float f = default; NPCWrapper npcWrapper = new NPCWrapper(npc); PlayerWrapper playerWrapper = new PlayerWrapper(player); Calc.OnHit(npcWrapper, playerWrapper); Calc.ModifyHitBy(npcWrapper, playerWrapper, ref damage, ref f, ref crit); }
public override void ModifyHitPlayer(NPC npc, Player target, ref int damage, ref bool crit) { Element element = new NPCWrapper(npc).Offensive; if (Main.expertMode) { if (Main.bloodMoon && Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneOverworldHeight || Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneSkyHeight) { if (element == Element.blood) { damage = (int)(damage * RainMultiplier); } } if (Main.eclipse && Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneOverworldHeight || Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneSkyHeight) { if (element == Element.dark) { damage = (int)(damage * RainMultiplier); } } if (Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneRain) { if (element == Element.water) { damage = (int)(damage * RainMultiplier); } if (element == Element.fire) { damage = (int)(damage * (1 / RainMultiplier)); } } if (Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneSnow) { if (element == Element.ice) { damage = (int)(damage * RainMultiplier); } } if (Main.player[(int)(Player.FindClosest(npc.position, npc.width, npc.height))].ZoneSandstorm) { switch (element) { case Element.ground: case Element.rock: case Element.steel: damage = (int)(damage * RainMultiplier); break; } } } }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); Rectangle rectangle1 = new Rectangle((int)((double)Main.mouseX + (double)Main.screenPosition.X), (int)((double)Main.mouseY + (double)Main.screenPosition.Y), 1, 1); if ((double)Main.player[Main.myPlayer].gravDir == -1.0) { rectangle1.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } PlayerInput.SetZoom_UI(); IngameOptions.MouseOver(); IngameFancyUI.MouseOver(); for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active) { Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2, (int)Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height, Main.npc[index1].frame.Width, Main.npc[index1].frame.Height); if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92) { rectangle2 = new Rectangle((int)((double)Main.npc[index1].position.X + (double)Main.npc[index1].width * 0.5 - 32.0), (int)((double)Main.npc[index1].position.Y + (double)Main.npc[index1].height * 0.5 - 32.0), 64, 64); } bool flag1 = rectangle1.Intersects(rectangle2); bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1; if (flag2 && ( Main.npc[index1].type != 85 && Main.npc[index1].type != 341 && Main.npc[index1].aiStyle != 87 || Main.npc[index1].ai[0] != 0.0) && Main.npc[index1].type != 488) { if (flag1) { float buffer = 4 * Main.UIScale; float prev = 0; Element Primary = new NPCWrapper(Main.npc[index1]).Primary; Element Secondary = new NPCWrapper(Main.npc[index1]).Secondary; Element Quatrinary = new NPCWrapper(Main.npc[index1]).Offensive; var icon1 = GetTexture("Types/" + Formal.Name[Primary]); var icon2 = GetTexture("Types/" + Formal.Name[Secondary]); var icon4 = GetTexture("Types/" + Formal.Name[Quatrinary]); int yOffset = 38; int xOffset = 12; Main.spriteBatch.Begin(); int x = (int)((Main.mouseX + xOffset) * Main.UIScale); int y = (int)((Main.mouseY + yOffset) * Main.UIScale); if (Primary != Element.none && Primary != Element.levitate) { Main.spriteBatch.Draw(icon1, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); prev += icon1.Width * Main.UIScale + buffer; } if (Secondary != Element.none && Secondary != Element.levitate) { Main.spriteBatch.Draw(icon2, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } if (Quatrinary != Element.none && Quatrinary != Element.levitate) { Main.spriteBatch.Draw(icon4, new Vector2(x, y + icon1.Width * Main.UIScale + buffer), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } Main.spriteBatch.End(); break; } break; } } } //PlayerInput.SetZoom_UI(); base.ModifyInterfaceLayers(layers); }