public void ResPhasetest() { Player p1 = new Player(0); Player p2 = new Player(1); IGame game = mocks.Stub <IGame>(); Card attack = new Attack(CardSuit.Spade, 1); Phase a = new ActionPhase(p1); PhaseList ret = a.advance(new UseCardAction(attack, p2), game); Phase b = ret.pop(); AttackPhase b2 = b as AttackPhase; Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p2.handCards.Add(miss); p1.health = 1; Player[] p = new Player[1]; p[0] = p1; ret = b.advance(null, game); Phase c = ret.pop(); ResponsePhase c_ = c as ResponsePhase; Assert.IsNull(c_.responseYesOrNo(true, game)); }
public void Res3Phasetest() { // ActionPhase produces attackPhase Player p1 = mocks.Stub <Player>(0); Player p2 = mocks.Stub <Player>(1); IGame game = mocks.Stub <IGame>(); Card attack = new Attack(CardSuit.Spade, 1); // ActionPhase produces attackPhase ActionPhase a = new ActionPhase(p1); PhaseList ret = a.advance(new UseCardAction(attack, p2), game); Phase b = ret.pop(); AttackPhase b2 = b as AttackPhase; Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; Player[] p = new Player[1]; p[0] = p1; // AttackPhase produces responsePhase ret = b.advance(null, game); Phase c = ret.pop(); ResponsePhase c_ = c as ResponsePhase; Assert.AreEqual(c_.ToString(), "Response Phase of 1"); }
public void Res5Phasetest() { SunQuan p1 = new SunQuan(0); LiuBei p2 = new LiuBei(1); List <Card> x = new List <Card>(); Player[] p = new SunQuan[1]; p[0] = p1; Miss miss = new Miss(CardSuit.Diamond, 2); Card attack = new Attack(CardSuit.Spade, 1); x.Add(miss); x.Add(attack); Game game = new Game(p, new CardSet(x)); // ActionPhase produces attackPhase ActionPhase a = new ActionPhase(p1); PhaseList ret = a.advance(new UseCardAction(attack, p2), game); Phase b = ret.pop(); AttackPhase b2 = b as AttackPhase; p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; // AttackPhase produces responsePhase ret = b.advance(null, game); Phase c = ret.pop(); ResponsePhase c_ = c as ResponsePhase; Assert.IsInstanceOfType(a.responseAbilityActionSun(new AbilityActionSun(attack), game), typeof(PhaseList)); }
public ActionResult Edit(int id, Miss mis) { HttpClient client = new HttpClient(); mission p = new mission() { dateDu = mis.dateDu, dateFin = mis.dateFin, libelle = mis.libelle, montantAlloue = mis.montantAlloue, motifMission = mis.motifMission, lieuMission = mis.lieuMission, etat = mis.etat }; client.BaseAddress = new Uri("http://localhost:9080"); var response = client.PutAsJsonAsync("/pidev-web/rest/projet", p).Result; if (response.IsSuccessStatusCode) { Console.Write("Success"); } else { Console.Write("Error"); } return(RedirectToAction("Index")); }
static Pixel DrawAllSprites(int x, int y) { if (Ship.IsOnSprite(x, y)) { return(Ship.GetPixel(x, y)); } foreach (Missile Miss in Missiles) { if (Miss.IsOnSprite(x, y)) { return(Miss.GetPixel(x, y)); } } foreach (EnergyCell Energy in EnergyCells) { if (Energy.IsOnSprite(x, y)) { return(Energy.GetPixel(x, y)); } } return(new Pixel((char)0x00, ConsoleColor.Black)); }
public void getCardIDTest() { List <Card> ls = new List <Card>(); Card a = new Attack(CardSuit.Club, 0); ls.Add(a); Card b = new Miss(CardSuit.Club, 1); ls.Add(b); Card c = new Miss(CardSuit.Diamond, 2); ls.Add(c); Card d = new Attack(CardSuit.Spade, 3); ls.Add(d); Card e = new Wine(CardSuit.Club, 4); ls.Add(e); ICardSet s = new CardSet(ls); Assert.AreEqual(a, s[s[a]]); Assert.AreEqual(b, s[s[b]]); Assert.AreEqual(c, s[s[c]]); Assert.AreEqual(d, s[s[d]]); Assert.AreEqual(e, s[s[e]]); }
protected void Update() { NowVector = NextVector; transform.position = NowVector; RailR += RSpeed; Angle += W; if (IsRotatToFace) { transform.Rotate(-transform.rotation.eulerAngles); transform.Rotate(new Vector3(0, 0, Mathf.Rad2Deg * FaceAngle - 90)); } if (transform.position.x > 10 || transform.position.x < -10 || transform.position.y > 10 || transform.position.y < -10) { Destroy(gameObject); } if (player != null) { if (Box.Miss(this, player)) { Miss?.Invoke(this, new MissEventArgs()); Destroy(gameObject); } } if (onDestroy) { Destroy(gameObject); } }
public void StartMiss(Vector3 position, Vector3 scale) { tempMiss = GetAvailableMiss(); if (tempMiss != null) { tempMiss.Activate(position, scale); } }
public void ShouldMapAMatchingStringOnToAnEnumCaseInsensitively() { var source = new PublicField <string> { Value = Miss.ToString().ToLowerInvariant() }; var result = Mapper.Map(source).OnTo(new PublicProperty <Title>()); result.Value.ShouldBe(Miss); }
// Start is called before the first frame update public override void OnStart() { misses = new List <Miss>(); for (int i = 0; i < size; i++) { tempMiss = Instantiate(missPrefab, transform, false); misses.Add(tempMiss); misses[i].OnStart(); } }
public async Task Run(Miss miss) { var pr = Policy.Handle <SqlException>() .WaitAndRetryAsync(3, c => TimeSpan.FromMilliseconds(c * 200)) .ExecuteAndCaptureAsync(async() => await UpdateEnttAcceptanceMissortAsync(miss)); pr.Wait(); if (null != pr.Result.FinalException) { throw new Exception("Fail updating PUP Stat", pr.Result.FinalException); } }
public void responseCardActionTest() { Player p1 = mocks.Stub <Player>(0); IGame game = mocks.Stub <IGame>(); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); // ActionPhase produces attackPhase UserActionPhase a = new DiscardPhase(p1); Assert.IsInstanceOfType(a.responseCardAction(attack, game), typeof(PhaseList)); }
public void AddSplitBattleBillboard(Vector3 pos, int blood, SplitBattleBillboardType type) { //return; //var head = new MonsterHead(text, type); //Quaternion qu = new Quaternion(); //qu.eulerAngles = new Vector3(0, 0, 0); //head.AddToParent(m_stage, qu, pos); SplitBattleBillboard sb = null; SuperBattleBillboard ssb = null; switch (type) { case SplitBattleBillboardType.CriticalMonster: ssb = new CriticalMonster(blood); break; case SplitBattleBillboardType.CriticalPlayer: ssb = new CriticalPlayer(blood); break; case SplitBattleBillboardType.BrokenAttack: ssb = new BrokenAttack(blood); break; case SplitBattleBillboardType.NormalMonster: sb = new NormalMonster(blood); break; case SplitBattleBillboardType.NormalPlayer: sb = new NormalPlayer(blood); break; case SplitBattleBillboardType.Miss: default: sb = new Miss(blood); break; } if (sb != null) { sb.SetBillboardPos(pos); } else { ssb.SetBillboardPos(pos); } }
public override Dictionary <string, string> GetCharacterDisplayCalculationValues() { Dictionary <string, string> dictValues = new Dictionary <string, string>(); int armorCap = (int)Math.Ceiling((1402.5f * TargetLevel) - 66502.5f); float levelDifference = 0.2f * (TargetLevel - 70); dictValues.Add("Health", BasicStats.Health.ToString()); dictValues.Add("Armor", BasicStats.Armor.ToString()); dictValues.Add("Stamina", BasicStats.Stamina.ToString()); dictValues.Add("Agility", BasicStats.Agility.ToString()); dictValues.Add("Defense", Defense.ToString()); dictValues.Add("Miss", Miss.ToString() + "%"); dictValues.Add("Dodge", Dodge.ToString() + "%"); dictValues.Add("Parry", Parry.ToString() + "%"); dictValues.Add("Block", Block.ToString() + "%"); dictValues.Add("Block Value", BlockValue.ToString() + "%"); dictValues.Add("Avoidance", Avoidance.ToString() + "%"); dictValues.Add("Mitigation", Mitigation.ToString()); dictValues.Add("Spell Damage", _basicStats.SpellDamageRating.ToString()); dictValues.Add("Total Mitigation", TotalMitigation.ToString() + "%"); if (CritAvoidance == (5f + levelDifference)) { dictValues.Add("Chance to be Crit", ((5f + levelDifference) - CritAvoidance).ToString() + "%*Exactly enough defense rating/resilience to be uncrittable by bosses."); } else if (CritAvoidance < (5f + levelDifference)) { dictValues.Add("Chance to be Crit", ((5f + levelDifference) - CritAvoidance).ToString() + string.Format("%*CRITTABLE! Short by {0} defense rating or {1} resilience to be uncrittable by bosses.", Math.Ceiling(((5f + levelDifference) - CritAvoidance) * 60f), Math.Ceiling(((5f + levelDifference) - CritAvoidance) * 39.423f))); } else { dictValues.Add("Chance to be Crit", ((5f + levelDifference) - CritAvoidance).ToString() + string.Format("%*Uncrittable by bosses. {0} defense rating or {1} resilience over the crit cap.", Math.Floor(((5f + levelDifference) - CritAvoidance) * -60f), Math.Floor(((5f + levelDifference) - CritAvoidance) * -39.423f))); } dictValues.Add("Overall Points", OverallPoints.ToString()); dictValues.Add("Mitigation Points", MitigationPoints.ToString()); dictValues.Add("Survival Points", SurvivalPoints.ToString()); dictValues.Add("Overall", Math.Round(OverallTPS) + " tps"); dictValues.Add("Holy Shield", Math.Round(HolyShieldTPS) + " tps"); dictValues.Add("Seal of Right", Math.Round(SoRTPS) + " tps"); dictValues.Add("Judgement of Right", Math.Round(JoRTPS) + " tps"); dictValues.Add("Consecrate", Math.Round(ConsecrateTPS) + " tps"); dictValues.Add("Misc", Math.Round(MiscTPS) + " tps"); return(dictValues); }
public async Task <string> GetContent() { if (MissCount == 1) { Miss.CurrentMiss = 0; } if (Miss.CurrentMiss.HasValue) { return(await Miss.GetOrCreateMissMessage(Context)); } else { return($"Found **{MissCount}** misses"); } }
public void ShuffleTwoCardTest() { Card a = new Attack(CardSuit.Club, 0); Card b = new Miss(CardSuit.Club, 1); ICollection <Card> ls = new List <Card>(); ls.Add(a); ls.Add(b); ICardSet s = new CardSet(ls); Card x = s.drawOne(); Card y = s.drawOne(); Assert.IsTrue((a.Equals(x) && b.Equals(y)) || (a.Equals(y) && b.Equals(x))); }
private async Task UpdateEnttAcceptanceMissortAsync(Miss miss) { var date = miss.Date; date = date.AddHours(miss.Time.Hour).AddMinutes(miss.Time.Minute).AddSeconds(miss.Time.Second).AddMilliseconds(miss.Time.Millisecond); var query = $"UPDATE [Entt].[Acceptance] SET [IsMissort] = 1, [MissortLocation] = '{miss.LocationId}', [MissortDateTime] = '{date.ToString("yyyy-MM-dd HH:mm:ss")}' WHERE [ConsignmentNo] = '{miss.ConsignmentNo}'"; using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Entt"].ConnectionString)) using (var cmd = new SqlCommand(query, conn)) { await conn.OpenAsync(); await cmd.ExecuteNonQueryAsync(); } }
protected override bool OnReceiveIRPulseMessage(PulseSpaceDurationList rawDataBuffer, IRPulseMessage message) { if (CheckMessage(message)) { if (_message != null) { throw new Exception("Message already has a value."); } _message = message; return(false); // Got the message, stop receiving IR. } else { Miss?.Invoke(this, EventArgs.Empty); return(true); // Not a good IR signal, keep trying. } }
public void AttackMissTest() { Player p1 = mocks.Stub <Player>(0); Player p2 = mocks.Stub <Player>(1); IGame game = mocks.Stub <IGame>(); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); // ActionPhase produces attackPhase Phase a = new ActionPhase(p1); PhaseList ret = a.advance(new UseCardAction(attack, p2), game); Phase b = ret.pop(); Assert.IsInstanceOfType(b, typeof(AttackPhase)); AttackPhase b2 = b as AttackPhase; Assert.AreEqual(attack, b2.attack); Assert.AreEqual(a, b2.actionPhase); Assert.AreEqual(p1, b2.player); Assert.AreEqual(p2, b2.targets[0]); Assert.AreEqual(a, ret.pop()); Assert.IsTrue(ret.isEmpty()); // AttackPhase produces responsePhase ret = b.advance(null, game); Phase c = ret.pop(); Assert.IsInstanceOfType(c, typeof(ResponsePhase)); ResponsePhase c_ = c as ResponsePhase; Assert.AreEqual(p2, c_.player); Phase c2 = ret.pop(); Assert.IsInstanceOfType(c2, typeof(AttackPhase)); Assert.AreEqual(b, c2); Assert.IsTrue(ret.isEmpty()); // response with cancel ret = c.advance(new CardAction(miss), game); Assert.IsTrue(ret.isEmpty()); // attackPhase produces nothing ret = c2.advance(null, game); Assert.IsTrue(ret.isEmpty()); }
public void resAdvanceTest4() { Player p1 = new Player(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); // ActionPhase produces attackPhase UserActionPhase a = new Testuserphase(p1, 1); Assert.AreEqual(a.responseYesOrNo(true, game), null); }
public void autoAdvanceTest2() { ZhangFei p1 = new ZhangFei(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); // ActionPhase produces attackPhase UserActionPhase a = new ActionPhase(p1); Assert.AreEqual(a.autoAdvance(game), null); }
public void autoAdvanceTest() { ZhangFei p1 = new ZhangFei(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); // ActionPhase produces attackPhase UserActionPhase a = new DiscardPhase(p1); Assert.IsInstanceOfType(a.autoAdvance(game), typeof(PhaseList)); }
public void ReciveData() { while (true) { var buffer = new byte[4096]; var bytesReceive = _socket.Receive(buffer); if (bytesReceive == 0) { continue; } var stream = new MemoryStream(); var formatter = new XmlSerializer(typeof(Message)); stream.Write(buffer, 0, bytesReceive); stream.Seek(0, SeekOrigin.Begin); var message = (Message)formatter.Deserialize(stream); switch (message.Info) { case MessageEnum.Coordinate: CheckCoordinate?.Invoke(message); break; case MessageEnum.Message: Message?.Invoke(message); break; case MessageEnum.Shoot: Shoot?.Invoke(message); break; case MessageEnum.Miss: Miss?.Invoke(message); break; case MessageEnum.Win: Win?.Invoke(message); break; } } }
protected override bool OnReceivePulseSpaceBlock(PulseSpaceDurationList buffer) { if (buffer.Count < (LeadInPatternDurations.Count + 5)) { return(true); } for (int i = 0; i < LeadInPatternDurations.Count; i++) { const int errorMagin = 100; if (buffer[i] < (LeadInPatternDurations[i] - errorMagin) || buffer[i] > (LeadInPatternDurations[i] + errorMagin)) { Miss?.Invoke(this, EventArgs.Empty); return(true); // Wrong pattern, discard this IR message. } } _lastReceived = buffer.Copy(); return(false); }
public void VisiblePhaseSuntest() { Player p1 = new Player(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); Player[] p = new Player[1]; p[0] = p1; // ActionPhase produces attackPhase UserActionPhase a = new DiscardPhase(p1); Assert.AreEqual(a.responseAbilityActionSun(new AbilityActionSun(new Attack(CardSuit.Spade, (byte)1)), game), null); }
public void resAdvanceTest6() { Player p1 = new Player(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); // ActionPhase produces attackPhase UserActionPhase a = new ActionPhase(p1); Player[] p = new Player[1]; p[0] = p1; Assert.AreEqual(a.responseCardAction(miss, game), null); }
public void resAdvanceTest3() { ZhangFei p1 = new ZhangFei(0); Card attack = new Attack(CardSuit.Spade, 1); Miss miss = new Miss(CardSuit.Diamond, 2); p1.handCards.Add(attack); p1.handCards.Add(miss); p1.health = 1; IGame game = mocks.Stub <IGame>(); // ActionPhase produces attackPhase UserActionPhase a = new ActionPhase(p1); PhaseList ls = a.timeOutAdvance(game); Assert.IsInstanceOfType(ls.pop(), typeof(DiscardPhase)); Assert.IsTrue(ls.isEmpty()); }
public void UsageTest() { Card x; x = new Attack(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Miss(CardSuit.Club, 0); Assert.AreEqual(-1, x.numOfTargets()); // this means not usable x = new Wine(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Peach(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Negate(CardSuit.Club, 0); Assert.AreEqual(-1, x.numOfTargets()); x = new Barbarians(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new HailofArrow(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new PeachGarden(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Wealth(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Steal(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Break(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Capture(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Starvation(CardSuit.Club, 0); Assert.AreEqual(1, x.numOfTargets()); x = new Crossbow(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new IceSword(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new Scimitar(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new BlackShield(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); x = new EightTrigrams(CardSuit.Club, 0); Assert.AreEqual(0, x.numOfTargets()); }
// Update is called once per frame void Update() { transform.position = NextVector; if (IsRotatToFace) { transform.Rotate(-transform.rotation.eulerAngles); transform.Rotate(new Vector3(0, 0, Mathf.Rad2Deg * FaceAngle - 90)); } if (player != null) { if (Box.Miss(this, player)) { Miss?.Invoke(this, new MissEventArgs()); Destroy(gameObject); } } if (onClear) { Destroy(gameObject); } }
public WhiteAttackTable( Miss missChance, Dodge dodgeChance, Parry parryChance, GlancingBlow glancingBlowChance, CrushingBlow crushingBlowChance, Block blockChance, CriticalStrike criticalStrikeChance) { var chances = new List <Rating> { missChance, dodgeChance, parryChance, glancingBlowChance, crushingBlowChance, blockChance, criticalStrikeChance }; _ranges = CalculateAttackTableRanges(chances); }