void Bleed(Player target, int hitDamage) { int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue); int duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue); target.GetModPlayer <BuffPlayer>().AddBleedBuff(target, damage, duration); }
void SpawnBurst(Player player, Entity target, int hitDamage) { PlaySound(player); int spikeCount = 5; float speed = 20; float halfArc = 0.7f; float arc = halfArc * 2; float angleIncrement = arc / (spikeCount - 1); float angle = (target.Center - player.Center).ToRotation() - halfArc; int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); int spawnerBurst = spikeCount / 2; for (int i = 0; i < spikeCount; i++) { Vector2 velocity = angle.ToRotationVector2() * speed; Projectile.NewProjectile( position: player.Center, velocity: velocity, Type: ModContent.ProjectileType <IceBurst>(), Damage: damage, KnockBack: 0, Owner: player.whoAmI, ai0: Type3.GetValue(), ai1: i == spawnerBurst ? 1f : 0f); angle += angleIncrement; } }
void Bleed(NPC target, int hitDamage) { int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, int.MaxValue); int duration = (int)MathHelper.Clamp(Type3.GetValue() * 60, 1, int.MaxValue); BuffNPC pomNPC = target.GetGlobalNPC <BuffNPC>(); pomNPC.AddBleedBuff(target, damage, duration); }
public void Dynamicly_maps_null_to_null() { Type1 type = null; Type3 mappedType = type.DynamicMap <Type3>(); mappedType.Should().Be.Null(); }
public static string Method(Type1 a, Type2 b, Type3 c, Type4 d) { a = a ?? default1; b = b ?? default2; c = c ?? default3; d = d ?? default4; //do smth }
internal static Dungeon GetDungeon(int id) { MySqlConnection conn = GetDBConnection(); conn.Open(); string sql = "SELECT type FROM Quest WHERE id ='" + id + "';"; //проверить названия колонок в таблице MySqlCommand command = new MySqlCommand(sql, conn); int type = Convert.ToInt32(command.ExecuteScalar()); conn.Close(); Dungeon dungeon = new Type3(); switch (type) { case 1: dungeon = new Type1(); break; case 2: dungeon = new Type2(); break; case 3: dungeon = new Type3(); break; default: Console.WriteLine("Ooopss..."); break; } //присваеваем всем полям данжна значения бд conn.Open(); sql = "SELECT * FROM Quest WHERE id ='" + id + "';"; //проверить названия колонок в таблице command = new MySqlCommand(sql, conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { dungeon.id = id; dungeon.mainText = Convert.ToString(reader[2]); dungeon.type = Convert.ToInt32(reader[1]); dungeon.answ1 = Convert.ToString(reader[3]); dungeon.answ2 = Convert.ToString(reader[4]); dungeon.answ3 = Convert.ToString(reader[5]); dungeon.reaction1 = Convert.ToString(reader[6]); dungeon.reaction2 = Convert.ToString(reader[7]); dungeon.reaction3 = Convert.ToString(reader[8]); } conn.Close(); return(dungeon); }
// Base class arguments first in the signature public Derived(Type1 t1, Type2 t2, Type3 t3, Type4 t4 = null) : Base(t1, t2) { _t3 = t3; if (t4 == null) { _t4 = DEFAULT_T4_VALUE; } else { _t4 = t4; } }
void SpawnIcycles(Player player, Entity target, int hitDamage) { PlaySound(player); int projectileNumber = Type2.GetValue(); for (int i = 0; i < projectileNumber; i++) { Vector2 velocity = (target.Center - player.Center).SafeNormalize(Vector2.Zero).RotatedBy(Main.rand.NextFloat(-0.4f, 0.4f)) * Main.rand.NextFloat(7f, 20f); int damage = (int)MathHelper.Clamp(hitDamage * Type3.GetValue(), 1, 999999); Projectile.NewProjectile(player.Center, velocity, ModContent.ProjectileType <Icicle>(), damage, 0, player.whoAmI); } }
void SpawnLifeOrbs(Player player, Entity target, int damage) { int projectileNumber = Type2.GetValue(); for (int i = 0; i < projectileNumber; i++) { Vector2 direction = Main.rand.NextVector2Unit(); Vector2 velocity = direction * Main.rand.NextFloat(5, 10); Vector2 projTarget = player.Center + Main.rand.NextVector2Circular(player.width * 1.5f, player.height * 1.5f); int heal = (int)MathHelper.Clamp(damage * Type3.GetValue(), 1, 999999); Projectile.NewProjectile(target.Center, velocity, ModContent.ProjectileType <LifeOrb>(), heal, 0, player.whoAmI, projTarget.X, projTarget.Y); } }
public void Test4() { unsafe { IntPtr iptr = Marshal.AllocHGlobal(10000); Type3 type3 = new Type3(); // System.TypeLoadException: Cannot marshal field 'listDoubles' of type 'Type3': Generic types // cannot be marshaled. Assert.ThrowsException <TypeLoadException>(() => Marshal.StructureToPtr(type3, iptr, false)); //Type3 type3b = Marshal.PtrToStructure<Type3>(iptr); //Assert.IsTrue(type3b.dateTime.Equals(new DateTime(2001, 2, 3))); } }
private void ClearBsaLists() { InitBsaLists(); Type0.Clear(); Type1.Clear(); Type2.Clear(); Type3.Clear(); Type4.Clear(); Type6.Clear(); Type7.Clear(); Type8.Clear(); }
void SpawnChainLightning(Player player, Entity target, int hitDamage, bool isNPC) { PlaySound(player); int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); Projectile.NewProjectile( position: player.Center, velocity: new Vector2(isNPC ? 1 : 0, target.whoAmI), Type: ModContent.ProjectileType <ChainLightning>(), Damage: damage, KnockBack: 0, Owner: player.whoAmI, ai0: Type3.GetValue()); }
void SpawnFrostPulse(Player player, Entity target, int hitDamage) { PlaySound(player); Vector2 velocity = (target.Center - player.Center).SafeNormalize(Vector2.One) * Main.rand.NextFloat(10f, 20f); int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); Projectile.NewProjectile( position: player.Center, velocity: velocity, Type: ModContent.ProjectileType <FrostPulse>(), Damage: damage, KnockBack: 0, Owner: player.whoAmI, ai0: Type3.GetValue()); }
void MainStart_New() { List <Type> list = new List <Type>(); Type f1 = new Type1(); Type f2 = new Type2(); Type f3 = new Type3(); list.Add(f1); list.Add(f2); list.Add(f3); foreach (IPrint item in list) { item.PrintFactoryType(); } }
void SpawnMeteor(Player player, Entity target, int hitDamage) { float height = 768f; Vector2 spawnOffset = new Vector2(0, -height).RotatedBy(Main.rand.NextFloat(-0.3f, 0.3f)); Vector2 targetPosition = target.Center + Main.rand.NextVector2Circular(target.width, target.height); Vector2 spawnPosition = targetPosition + spawnOffset; PlaySound(spawnPosition); int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); Projectile.NewProjectile( targetPosition + spawnOffset, targetPosition, ModContent.ProjectileType <Meteor>(), damage, 0, player.whoAmI, ai0: hitDamage * Type3.GetValue()); }
void Hit(Item item, Player player, int hitDamage) { if (item == player.HeldItem) { int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); int intervalTicks = (int)Math.Round(Type3.GetValue() * 60); if (intervalTicks < 1) { intervalTicks = 1; } int durationTicks = (int)Math.Round(Type1.GetValue() * 60); if (durationTicks < 1) { durationTicks = 1; } player.GetModPlayer <BuffPlayer>().AddStaticStrikeBuff(player, damage, intervalTicks, durationTicks, true); } }
public void SaveIBsaTypes() { ClearBsaLists(); foreach (var bsaEntry in IBsaTypes) { if (bsaEntry is BSA_Type0 type) { Type0.Add(type); } else if (bsaEntry is BSA_Type1 type1) { Type1.Add(type1); } else if (bsaEntry is BSA_Type2 type2) { Type2.Add(type2); } else if (bsaEntry is BSA_Type3 type3) { Type3.Add(type3); } else if (bsaEntry is BSA_Type4 type4) { Type4.Add(type4); } else if (bsaEntry is BSA_Type6 type6) { Type6.Add(type6); } else if (bsaEntry is BSA_Type7 type7) { Type7.Add(type7); } else if (bsaEntry is BSA_Type8 type8) { Type8.Add(type8); } } }
List <Type_3> GetType3(short count, int offset, List <Type_3> Type3, int idx) { if (Type3 == null) { Type3 = new List <Type_3>(); } for (int i = 0; i < count; i++) { Type3.Add(new Type_3() { Idx = idx, I_00 = BitConverter.ToUInt16(rawBytes, offset + 0), I_02 = (ushort)(BitConverter.ToUInt16(rawBytes, offset + 2) - BitConverter.ToUInt16(rawBytes, offset + 0)), I_04 = BitConverter.ToInt32(rawBytes, offset + 4), I_08 = BitConverter.ToInt32(rawBytes, offset + 8), }); offset += 12; } return(Type3); }
public override string GetTolltipText(Item item) { string plusMinus = Type3.GetValue() >= 0 ? "+" : "-"; return($"{Type1.GetValueFormat()}% chance to chain lightning for {Type2.GetValueFormat()}% damage that Shocks({plusMinus}{Type3.GetValueFormat()}%)"); }
public override string GetTolltipText(Item item) { char plusMinus = Type1.GetValue() < 0 ? '-' : '+'; return($"{ plusMinus }{ Type1.GetValueFormat() }% move speed for { Type2.GetValueFormat(1) }s when hit ({ Type3.GetValueFormat(1) }s CD)"); }
public override void PostHurt(Item item, Player player, bool pvp, bool quiet, double damage, int hitDirection, bool crit) { if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60)) { player.GetModPlayer <BuffPlayer>().AddGreavesMoveSpeedBuff(player, Type1.GetValue(), (int)Math.Round(Type2.GetValue() * 60), false); lastProcTime = Main.GameUpdateCount; } }
public override string GetTolltipText(Item item) { string plusMinus = Type3.GetValue() >= 0 ? "+" : "-"; return($"{Type1.GetValueFormat()}% chance for lightning to strike for {Type2.GetValueFormat()}% damage and leave Shocked Air({plusMinus}{Type3.GetValueFormat()}%)"); }
public override string GetTolltipText(Item item) { return($"On hit gain a buff for {Type1.GetValueFormat(1)}s that does {Type2.GetValueFormat()}% damage every {Type3.GetValueFormat(1)}s"); }
private void cbQuestionList_SelectedIndexChanged(object sender, EventArgs e) { try { if (cbQuestionList.SelectedIndex > 0) { btnSubmit.Text = "Zapisz"; btnDelete.Enabled = true; short id = Convert.ToInt16(cbQuestionList.SelectedItem); Repository r = new Repository(connStr); DbQuestion q = r.GetQuestion(id); if (q.QType == 2) { cbQuestionType.SelectedIndex = 1; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox2.SizeMode = PictureBoxSizeMode.Zoom; // ciągniemy obrazki z bazy Image[] images = r.loadImages(q.ID); q.Image = images[0]; q.ImageAlt = images[1]; pictureBox1.Image = q.Image; pictureBox2.Image = q.ImageAlt; } else { cbQuestionType.SelectedIndex = 0; } cbAnswerType.SelectedIndex = (int)q.Type >= 6? (int)q.Type - 2: (int)q.Type - 1; richTextBox1.Text = q.question.Replace(replace2, replace1); richTextBox1.Text = richTextBox1.Text.ReplaceApostropheToSymbol(); type1.Dispose(); type2.Dispose(); type3.Dispose(); type4.Dispose(); type5.Dispose(); type6.Dispose(); Point point = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); AnchorStyles anchor = AnchorStyles.Bottom | AnchorStyles.Left; switch (cbAnswerType.SelectedIndex) { case 0: type1 = new Type1(); type1.q = q; Controls.Add(type1); type1.Location = point; type1.Anchor = anchor; break; case 1: type2 = new Type2(); type2.q = q; Controls.Add(type2); type2.Location = point; type2.Anchor = anchor; break; case 2: type3 = new Type3(); type3.q = q; Controls.Add(type3); type3.Location = point; type3.Anchor = anchor; break; case 3: type4 = new Type4(); type4.q = q; Controls.Add(type4); type4.Location = point; type4.Anchor = anchor; break; case 4: type5 = new Type5(); type5.q = q; Controls.Add(type5); type5.Location = point; type5.Anchor = anchor; break; case 5: type6 = new Type6(); type6.q = q; Controls.Add(type6); type6.Location = point; type6.Anchor = anchor; break; default: break; } } else { cbQuestionType.SelectedIndex = 0; pictureBox1.Image = null; pictureBox2.Image = null; cbAnswerType_SelectedIndexChanged(sender, null); btnSubmit.Text = "Dodaj"; btnDelete.Enabled = false; richTextBox1.Text = ""; cbAnswerType.SelectedIndex = 1; //Domyslny typ2 przy wprowadzaniu nowego. (Jednego) } } catch (Exception ex) { reCounter++; if (reCounter == 5) { throw; } //Ponowna próba rekursywnie. cbQuestionList_SelectedIndexChanged(sender, e); } }
void GainDodgeChance(Item item, Player player) { if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type3.GetValue() * 60)) { int durationTicks = (int)Math.Round((Type2.GetValue() * 60)); player.GetModPlayer <BuffPlayer>().AddDodgeChanceBuff(player, Type1.GetValue(), durationTicks, false); lastProcTime = Main.GameUpdateCount; } }
public override string GetTolltipText(Item item) { string plusMinus = Type3.GetValue() >= 0 ? "+" : "-"; return($"{Type1.GetValueFormat()}% chance to Meteor for {Type2.GetValueFormat()}% damage that Ignites({plusMinus}{Type3.GetValueFormat()}%) and leaves Burning Air({plusMinus}{Type3.GetValueFormat()}%)"); }
// Base class arguments first in the signature public Derived(Type1 t1, Type2 t2, Type3 t3, Type4 t4 = null) : Base(t1, t2)
void SpawnLightningBolt(Player player, Entity target, int hitDamage) { float height = 512; Vector2 position = target.Center + Main.rand.NextVector2Circular(target.width, target.height) - new Vector2(0, height); PlaySound(position); int damage = (int)MathHelper.Clamp(hitDamage * Type2.GetValue(), 1, 999999); Projectile.NewProjectile(position, Vector2.Zero, ModContent.ProjectileType <LightningBolt>(), damage, 0, player.whoAmI, Type3.GetValue(), height); }
public override string GetTolltipText(Item item) { return($"Gain { Type1.GetValueFormat() }% Dodge chance for { Type2.GetValueFormat(1) }s when hit ({ Type3.GetValueFormat(1) }s CD)"); }
private void cbAnswerType_SelectedIndexChanged(object sender, EventArgs e) { try { type1.Dispose(); type2.Dispose(); type3.Dispose(); type4.Dispose(); type5.Dispose(); type6.Dispose(); Point point = new Point(250, richTextBox1.Size.Height + lower); AnchorStyles anchor = AnchorStyles.Bottom | AnchorStyles.Left; setRtbLocation(); switch (cbAnswerType.SelectedIndex) { case 0: type1 = new Type1(); Controls.Add(type1); type1.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type1.Anchor = anchor; break; case 1: type2 = new Type2(); Controls.Add(type2); type2.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type2.Anchor = anchor; break; case 2: type3 = new Type3(); Controls.Add(type3); type3.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type3.Anchor = anchor; break; case 3: type4 = new Type4(); Controls.Add(type4); type4.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type4.Anchor = anchor; break; case 4: type5 = new Type5(); Controls.Add(type5); type5.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type5.Anchor = anchor; break; case 5: type6 = new Type6(); Controls.Add(type6); type6.Location = new Point(250, richTextBox1.Size.Height + pictureBox1.Size.Height + lower); type6.Anchor = anchor; break; default: break; } } catch { // Druga próba rekursywnie. cbAnswerType_SelectedIndexChanged(sender, e); } }