public override void ProjModifyHitPvp(Item item, Player player, Projectile projectile, Player target, ref float damageMultiplier, ref bool crit) { if (player.HeldItem == item) { float value = Type1.GetValue(); damageMultiplier += value * PoMUtil.CountBuffs(target.buffType); } }
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 }
public void Dynamicly_maps_null_to_null() { Type1 type = null; Type3 mappedType = type.DynamicMap <Type3>(); mappedType.Should().Be.Null(); }
void Hit(Item item, Player player, Player target) { if (item == player.HeldItem && Main.rand.NextFloat(1) < Type1.GetValue()) { int durationTicks = (int)Math.Round(Type2.GetValue() * 60); target.AddBuff(BuffID.Confused, durationTicks, false); } }
static void Main2() { Func <Type2, Type1> f1 = MyMethod; Type1 t0 = f1(new Type3()); // Covariant return type and contravariant parameter type. Func <Type3, Type1> f2 = f1; Type1 t1 = f2(new Type3()); }
public override bool PreHurt(Item item, Player player, bool pvp, bool quiet, ref float damageMultiplier, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { if (AffixItemItem.IsAccessoryEquipped(item, player)) { damageMultiplier += Type1.GetValue(); } return(true); }
public override string GetTolltipText(Item item) { float value = Type1.GetValue(); float valueFormat = Type1.GetValueFormat(); char plusMinus = value < 0 ? '-' : '+'; return($"{ plusMinus }{ valueFormat }% crit damage"); }
public override string ToString() { // construct a string to return with the following format // Nat,Pokemon,HP,Atk,Def,SpA,SpD,Spe,Total // LC: good. return(string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}", Index, Name, HP, Attack, Defense, SpecialAttack, SpecialDefense, Speed, Total, Type1.ToString(), Type2 == PokemonType.None ? "" : Type2.ToString())); }
public override void ProjModifyHitNPC(Item item, Player player, Projectile projectile, NPC target, ref float damageMultiplier, ref float knockbackMultiplier, ref bool crit, ref int hitDirection) { if (player.HeldItem == item) { float value = Type1.GetValue(); damageMultiplier += value * PoMUtil.CountBuffs(target.buffType); } }
public void Execute(string xmlData) { Type1 type1Object = (new Deserializer <Type1>()).XML2Object(XML); var ws = new WSProxy1(); string response = ws.Method1(type1Object); // // lots of other lines of code that use type1VO, type1Object, the response, etc. // }
public override bool PlayerConsumeAmmo(Player player, Item item, Item ammo, ref float chanceToNotConsume) { if (AffixItemItem.IsArmorEquipped(item, player)) { float value = Type1.GetValue(); chanceToNotConsume += value; } return(true); }
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; } }
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 void ProjModifyHitNPC(Item item, Player player, Projectile projectile, NPC target, ref float damageMultiplier, ref float knockbackMultiplier, ref bool crit, ref int hitDirection) { NPC realTarget = target.realLife >= 0 ? Main.npc[target.realLife] : target; if (item == player.HeldItem && (realTarget.life / (float)realTarget.lifeMax) <= PathOfModifiers.lowHPThreshold) { damageMultiplier += Type1.GetValue(); } }
static void Main(string[] args) { Type1 something1 = new Type1(); Type2 something2 = new Type2(); something1.runTest(); something2.runTest(); Console.ReadKey(); }
void Hit(Item item, Player player) { if (player.HeldItem == item) { int durationTicks = (int)Math.Round(Type1.GetValue() * 60); player.AddBuff(BuffID.Flipper, durationTicks); player.AddBuff(BuffID.Gills, durationTicks); player.AddBuff(BuffID.WaterWalking, durationTicks); } }
void Crit(Player target, ref float damageMultiplier) { damageMultiplier += Type1.GetValue(); PoMEffectHelper.Crit(target.position, target.width, target.height, 50); if (Main.netMode == NetmodeID.MultiplayerClient) { EffectPacketHandler.CSyncCrit(target, 50); } lastProcTime = Main.GameUpdateCount; }
public ActionResult Edit([Bind(Include = "Id,Name")] Type1 type1) { if (ModelState.IsValid) { db.Entry(type1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(type1)); }
public override bool PreHurt(Item item, Player player, bool pvp, bool quiet, ref float damageMultiplier, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { if (AffixItemItem.IsArmorEquipped(item, player) && (Main.GameUpdateCount - lastProcTime) >= (int)Math.Round(Type2.GetValue() * 60)) { damageMultiplier += Type1.GetValue(); lastProcTime = Main.GameUpdateCount; } return(true); }
void GainBuffs(Item item, Player player) { if (AffixItemItem.IsArmorEquipped(item, player)) { int durationTicks = (int)Math.Round(Type1.GetValue() * 60); player.AddBuff(BuffID.Flipper, durationTicks); player.AddBuff(BuffID.Gills, durationTicks); player.AddBuff(BuffID.WaterWalking, durationTicks); } }
public override int GetHashCode() { unchecked { int hashCode = base.GetHashCode(); hashCode = (hashCode * 397) ^ (Type1 != null ? Type1.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Type2 != null ? Type2.GetHashCode() : 0); return(hashCode); } }
private static void Demo1() { Console.WriteLine("In Demo1"); try { Console.WriteLine("In try"); } finally { // Type1’s static constructor is implicitly called in here Type1.M(); } }
private static async Task <Type1> Method1Async() { Type1 t = null; await Task.Run(new Action(() => { t = new Type1(); Thread.Sleep(1000); })); return(t); }
public void PoolSizeTest() { int defaultPoolSize = ObjectPool <Type1> .DEFAULT_POOL_SIZE; Assert.AreEqual(defaultPoolSize, _type1Pool.PoolSize); Type1 acquiredObject = _type1Pool.AcquireObject(); Assert.AreEqual(defaultPoolSize - 1, _type1Pool.PoolSize); _type1Pool.ReleaseObject(acquiredObject); Assert.AreEqual(defaultPoolSize, _type1Pool.PoolSize); }
public ActionResult Create([Bind(Include = "Id,Name")] Type1 type1) { if (ModelState.IsValid) { db.Type1s.Add(type1); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(type1)); }
public void Test2() { unsafe { IntPtr iptr = Marshal.AllocHGlobal(1024); Type1 type1 = Marshal.PtrToStructure <Type1>(iptr); //void* ptr = iptr.ToPointer(); //*((Type1*)ptr) = new Type(); Assert.IsFalse(new Type1().Equals(type1)); } }
private void Awake() { if (gameObject.CompareTag(_PROJECTILE1_TAG)) { _type1 = gameObject.GetComponent <Type1>(); } if (gameObject.CompareTag(_PROJECTILE2_TAG)) { _type2 = gameObject.GetComponent <Type2>(); } }
public void DoesNotEnforceUniquenessAcrossTypes () { var sagaStorage = new InMemorySagaStorage(); var recycledId = "recycled-id"; var instanceOfType1 = new Type1 {Id = Guid.NewGuid(), Revision = 0, CorrelationId = recycledId}; var instanceOfType2 = new Type2 { Id = Guid.NewGuid(), Revision = 0, CorrelationId = recycledId }; sagaStorage.Insert(instanceOfType1, For(typeof(Type1))).Wait(); sagaStorage.Insert(instanceOfType2, For(typeof(Type2))).Wait(); }
void GainBuffs(Item item, Player player) { if (AffixItemItem.IsArmorEquipped(item, player)) { int durationTicks = (int)Math.Round(Type1.GetValue() * 60); player.AddBuff(BuffID.Dangersense, durationTicks); player.AddBuff(BuffID.Featherfall, durationTicks); player.AddBuff(BuffID.Gravitation, durationTicks); player.AddBuff(BuffID.Hunter, durationTicks); player.AddBuff(BuffID.ObsidianSkin, durationTicks); } }
void Heal(Item item, Player player) { if (AffixItemItem.IsAccessoryEquipped(item, player)) { int amount = (int)MathHelper.Clamp(player.statManaMax2 * Type1.GetValue(), 1, 9999999); if (amount > 0) { player.statMana += amount; PoMEffectHelper.HealMana(player, amount); } } }
public Dictionary <string, float> GetWeakness() { Dictionary <string, float> type1Weakness = Type1.GetWeaknesses(); Dictionary <string, float> type2Weakness = Type2.GetWeaknesses(); Dictionary <string, float> result = new Dictionary <string, float>(); foreach (KeyValuePair <string, float> modifier in type1Weakness) { result.Add(modifier.Key, type1Weakness[modifier.Key] * type2Weakness[modifier.Key]); } return(result); }
public Type3(Type1 type) { a1 = type; }
public void Method(Type1 item) { Console.WriteLine("Type1"); }
// This is the state machine method itself void IAsyncStateMachine.MoveNext() { String result = null; // Task's result value // Compiler-inserted try block ensures the state machine's task completes try { Boolean executeFinally = true; // Assume we're logically leaving the 'try' block if (m_state == -1) { // If 1st time in state machine method, m_local = m_argument; // execute start of original method } // Try block that we had in our original code try { TaskAwaiter<Type1> awaiterType1; TaskAwaiter<Type2> awaiterType2; switch (m_state) { case -1: // Start execution of code in 'try' // Call Method1Async and get its awaiter awaiterType1 = Method1Async().GetAwaiter(); if (!awaiterType1.IsCompleted) { m_state = 0; // 'Method1Async' is completing // asynchronously m_awaiterType1 = awaiterType1; // Save the awaiter for when we come back // Tell awaiter to call MoveNext when operation completes m_builder.AwaitUnsafeOnCompleted(ref awaiterType1, ref this); // The line above invokes awaiterType1's OnCompleted which approximately // calls ContinueWith(t => MoveNext()) on the Task being awaited. // When the Task completes, the ContinueWith task calls MoveNext executeFinally = false; // We're not logically leaving the 'try' // block return; // Thread returns to caller } // 'Method1Async' completed synchronously break; case 0: // 'Method1Async' completed asynchronously awaiterType1 = m_awaiterType1; // Restore most-recent awaiter break; case 1: // 'Method2Async' completed asynchronously awaiterType2 = m_awaiterType2; // Restore most-recent awaiter goto ForLoopEpilog; } // After the first await, we capture the result & start the 'for' loop m_resultType1 = awaiterType1.GetResult(); // Get awaiter's result ForLoopPrologue: m_x = 0; // 'for' loop initialization goto ForLoopBody; // Skip to 'for' loop body ForLoopEpilog: m_resultType2 = awaiterType2.GetResult(); m_x++; // Increment x after each loop iteration // Fall into the 'for' loop's body ForLoopBody: if (m_x < 3) { // 'for' loop test // Call Method2Async and get its awaiter awaiterType2 = Method2Async().GetAwaiter(); if (!awaiterType2.IsCompleted) { m_state = 1; // 'Method2Async' is completing asynchronously m_awaiterType2 = awaiterType2; // Save the awaiter for when we come back // Tell awaiter to call MoveNext when operation completes m_builder.AwaitUnsafeOnCompleted(ref awaiterType2, ref this); executeFinally = false; // We're not logically leaving the 'try' block return; // Thread returns to caller } // 'Method2Async' completed synchronously goto ForLoopEpilog; // Completed synchronously, loop around } } catch (Exception) { Console.WriteLine("Catch"); } finally { // Whenever a thread physically leaves a 'try', the 'finally' executes // We only want to execute this code when the thread logically leaves the 'try ' if (executeFinally) { Console.WriteLine("Finally"); } } result = "Done"; // What we ultimately want to return from the async function } catch (Exception exception) { // Unhandled exception: complete state machine's Task with exception m_builder.SetException(exception); return; } // No exception: complete state machine's Task with result m_builder.SetResult(result); }