public void When_Type_Is_Object_DataFormat_Json_Is_Used() { var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter())); IOStrategy.Execute(delete); //Add the key var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter())); Assert.IsTrue(IOStrategy.Execute(add).Success); var getQ = new GetQ <dynamic>(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new AutoByteConverter())); getQ.CreateExtras(); Assert.AreEqual(DataFormat.Json, getQ.Format); var result = IOStrategy.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Json, getQ.Format); }
public void When_Type_Is_Object_DataFormat_Json_Is_Used() { var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOService.Execute(delete); //Add the key var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOService.Execute(add).Success); var getQ = new GetQ <dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.Json, getQ.Format); var result = IOService.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Json, getQ.Format); }
public void When_Key_Exists_GetK_Returns_Value() { var key = "When_Key_Exists_GetQ_Returns_Value"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter())); IOStrategy.Execute(delete); //Add the key var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter())); Assert.IsTrue(IOStrategy.Execute(add).Success); var getK = new GetQ <dynamic>(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new AutoByteConverter())); var result = IOStrategy.Execute(getK); Assert.IsTrue(result.Success); var expected = new { foo = "foo" }; Assert.AreEqual(result.Value.foo.Value, expected.foo); }
public void When_Type_Is_String_DataFormat_String_Is_Used() { var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add <string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var getQ = new GetQ <string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.String, getQ.Format); var result = IOStrategy.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.String, getQ.Format); }
private bool notKilleableWithOthersSpells(Obj_AI_Hero tar) { double totalDamage = 0; double qDamage = 0d, wDamage = 0d, eDamage = 0d; if (GetQ.IsReady()) { qDamage = GetQ.GetDamage(tar); } if (GetW.IsReady()) { wDamage = GetW.GetDamage(tar); } if (GetE.IsReady()) { eDamage = GetE.GetDamage(tar); } totalDamage = qDamage + wDamage + eDamage; if (isKilleable(tar, totalDamage)) { return(false); } return(true); }
public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used() { var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add <byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var getQ = new GetQ <byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.Binary, getQ.Format); var result = IOStrategy.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Binary, getQ.Format); }
public void CastQE(Obj_AI_Base target) { if (GetE.IsReady()) { // var prediction = Prediction.GetPrediction(target, 500); var predictionInput = new PredictionInput { Aoe = false, Collision = EQ.Collision, Speed = EQ.Speed, Delay = EQ.Delay, Range = EQ.Range, From = HeroManager.Player.ServerPosition, Radius = EQ.Width, Unit = target, Type = SkillshotType.SkillshotLine }; var prediction = Prediction.GetPrediction(predictionInput); Vector3 castQpos = prediction.CastPosition; if (HeroManager.Player.Distance(castQpos) > GetQ.Range) { castQpos = HeroManager.Player.Position.Extend(castQpos, GetE.Range); } if (prediction.Hitchance >= HitChance.VeryHigh) { EQcastNow = true; GetQ.Cast(castQpos); } } }
public void Test_OperationResult_Returns_Defaults() { var op = new GetQ<string>("Key", GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout); var result = op.GetResultWithValue(); Assert.IsNull(result.Value); Assert.IsEmpty(result.Message); }
public void Test_OperationResult_Returns_Defaults() { var op = new GetQ <string>("Key", GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout); var result = op.GetResultWithValue(); Assert.IsNull(result.Value); Assert.IsEmpty(result.Message); }
public void Test_OperationResult_Returns_Defaults() { var op = new GetQ <string>("Key", GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new AutoByteConverter())); var result = op.GetResult(); Assert.IsNull(result.Value); Assert.IsEmpty(result.Message); }
public void TryBallE(AIHeroClient t) { if (!castE(t)) { if (GetQ.IsReady()) { CastQE(t); } } }
public void TryBallE(Obj_AI_Hero t) { if (!castE(t)) { if (GetQ.IsReady()) { CastQE(t); } } }
public bool CastW() { if (!GetW.IsReady()) { return(false); } var wTarget = TargetSelector.GetTarget(GetW.Range, DamageType.Magical); if (wTarget == null) { return(false); } if (!GetW.IsInRange(wTarget)) { return(false); } ; if (ObjectManager.Player.GetBuff("syndrawtooltip") != null) { if (ObjectManager.Player.GetBuff("syndrawtooltip").IsActive&& GetW.IsReady()) { if (GetW.IsInRange(wTarget)) { var predictW = GetQ.GetPrediction(wTarget, true); if (predictW.Hitchance >= HitChance.High) { GetW.Cast(predictW.CastPosition); } GetW.Cast(wTarget.Position, true); // GetW.Cast() return(true); } } } if (GetW.IsReady()) { var orb = GetOrbs.GetOrbToGrab((int)GetW.Range); GetW.Cast(orb); } // Game.Print("-> " + ObjectManager.Player.GetBuff(+ " toggle " + ObjectManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState)); return(false); }
public void Test_Clone() { var operation = new GetQ <string>("key", GetVBucket(), Transcoder, OperationLifespanTimeout) { Cas = 1123 }; var cloned = operation.Clone(); Assert.AreEqual(operation.CreationTime, cloned.CreationTime); Assert.AreEqual(operation.Cas, cloned.Cas); Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index); Assert.AreEqual(operation.Key, cloned.Key); Assert.AreEqual(operation.Opaque, cloned.Opaque); }
public bool CastQ() { if (!GetQ.IsReady()) { return(false); } var qTarget = TargetSelector.GetTarget(GetQ.Range, TargetSelector.DamageType.Magical); if (qTarget != null) { var predictQ = GetQ.GetPrediction(qTarget, true); if (predictQ.Hitchance >= HitChance.VeryHigh) { return(GetQ.Cast(predictQ.CastPosition)); } } return(false); }
private bool NotKilleableWithOtherSpells(Obj_AI_Hero target, SyndraCore core) { if (GetQ.IsReady() && GetQ.IsKillable(target)) { CastQ(); return(false); } if (GetW.IsReady() && GetW.IsKillable(target)) { CastW(); return(false); } if (GetE.IsReady() && GetE.IsKillable(target)) { CastE(core); return(false); } return(true); }
public override IOperation Clone() { var cloned = new GetQ <T> { Key = Key, Content = Content, Transcoder = Transcoder, VBucketId = VBucketId, Opaque = Opaque, Attempts = Attempts, Cas = Cas, CreationTime = CreationTime, LastConfigRevisionTried = LastConfigRevisionTried, BucketName = BucketName, ErrorCode = ErrorCode }; return(cloned); }
public void When_Key_Exists_GetK_Returns_Value() { var key = "When_Key_Exists_GetQ_Returns_Value"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout); IOService.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout); Assert.IsTrue(IOService.Execute(add).Success); var getK = new GetQ<dynamic>(key, GetVBucket(), new DefaultTranscoder(), OperationLifespanTimeout); var result = IOService.Execute(getK); Assert.IsTrue(result.Success); var expected = new {foo = "foo"}; Assert.AreEqual(result.Value.foo.Value, expected.foo); }
public bool CastW() { if (!GetW.IsReady()) { return(false); } var wTarget = TargetSelector.GetTarget(GetW.Range, TargetSelector.DamageType.Magical); if (wTarget == null) { return(false); } if (GetW.IsInRange(wTarget)) { if (HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState == 1 && GetW.IsReady()) { var orb = GetOrbs.GetOrbToGrab((int)GetW.Range); GetW.Cast(orb); } else if (HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState != 1 && HeroManager.Player.Spellbook.GetSpell(SpellSlot.W).ToggleState != 1 && GetW.IsReady()) { if (GetW.IsInRange(wTarget)) { if (GetOrbs.WObject(false) == null) { return(false); } GetW.From = GetOrbs.WObject(false).ServerPosition; var predictW = GetQ.GetPrediction(wTarget, true); if (predictW.Hitchance >= HitChance.VeryHigh) { GetW.Cast(predictW.CastPosition, true); } return(true); } } } return(false); }
public void When_Type_Is_String_DataFormat_String_Is_Used() { var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var getQ = new GetQ<string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.String, getQ.Format); var result = IOStrategy.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.String, getQ.Format); }
public void When_Type_Is_Object_DataFormat_Json_Is_Used() { var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOService.Execute(delete); //Add the key var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOService.Execute(add).Success); var getQ = new GetQ<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.Json, getQ.Format); var result = IOService.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Json, getQ.Format); }
public override bool castQ(Core core) { if (GetQ.IsReady()) { var qTarget = TargetSelector.GetTarget(GetQ.Range, TargetSelector.DamageType.Magical); var onlyBlazedQ = core.GetMenu.getMenuBoolOption("CQS"); if (qTarget == null || !GetQ.IsInRange(qTarget)) { return(false); } if (onlyBlazedQ) { if (isBlazed(qTarget)) { core.cast(qTarget, GetQ, SebbyLib.Prediction.SkillshotType.SkillshotLine); } } else { core.cast(qTarget, GetQ, SebbyLib.Prediction.SkillshotType.SkillshotLine); } } return(false); }
public void Test_Clone() { var operation = new GetQ<string>("key", GetVBucket(), Transcoder, OperationLifespanTimeout) { Cas = 1123 }; var cloned = operation.Clone(); Assert.AreEqual(operation.CreationTime, cloned.CreationTime); Assert.AreEqual(operation.Cas, cloned.Cas); Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index); Assert.AreEqual(operation.Key, cloned.Key); Assert.AreEqual(operation.Opaque, cloned.Opaque); }
public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used() { var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json"; //delete the value if it exists var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout); IOStrategy.Execute(delete); //Add the key var add = new Add<byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout); Assert.IsTrue(IOStrategy.Execute(add).Success); var getQ = new GetQ<byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout); getQ.CreateExtras(); Assert.AreEqual(DataFormat.Binary, getQ.Format); var result = IOStrategy.Execute(getQ); Assert.IsTrue(result.Success); Assert.AreEqual(DataFormat.Binary, getQ.Format); }