public bool ChooseAttackTarget(Arena.FightState state) { bool targetChosen = false; NewLinked<Team> targetTeams = GetTargets(state); NewLinked<Character> targets = new NewLinked<Character>(); for (int i = 0; i < targetTeams.Length; i++) for (int x = 0; x < targetTeams.Get(i)._members.Length; x++) { if (!targetTeams.Get(i)._members[x].IsDead) targets.Add(targetTeams.Get(i)._members[x]); } MenuItem<Character>[] menuItems = MakeMenu(targets); for (int i = 0; i < menuItems.Length; i++) menuItems[i].NeedsConfirm = false; Console.WriteLine("Choose a target to attack:"); Character attackTarget = Menu<Character>.ShowMenu(menuItems); if (attackTarget == null) targetChosen = false; else { this.Attack(attackTarget, state); targetChosen = true; } return targetChosen; }
public Arena() { instance = this; mapData = MapGenerator.Generate(); FSprite bgSprite = new FSprite("Arena/BG_1"); AddChild(bgSprite); AddChild(entityArea = new EntityArea()); float inset = 13; entityArea.bounds.x = -Config.WIDTH/2 + inset; entityArea.bounds.y = -Config.HEIGHT/2 + inset; entityArea.bounds.width = Config.WIDTH - inset*2; entityArea.bounds.height = Config.HEIGHT - inset*2; colorOverlay = new FSprite("WhiteBox"); colorOverlay.color = new Color(1,1,1,0); colorOverlay.width = Config.WIDTH; colorOverlay.height = Config.HEIGHT; entityArea.overlayContainer.AddChild(colorOverlay); AddChild(frontContainer = new FContainer()); dayManager = new DayManager(); CreateBuildings(); SetupPlayers(); ListenForUpdate(Update); }
public void ReachabilitySolverTestZero() { var arena = new Arena() .AddPlayerZeroNode(0) .AddPlayerOneNode(1) .AddPlayerOneNode(2) .AddPlayerZeroNode(3) .AddEdge(0, 1) .AddEdge(0, 2) .AddEdge(1, 1) .AddEdge(1, 3) .AddEdge(2, 2) .AddEdge(2, 3) .AddEdge(3, 0); var threeSet = new HashSet<int>(); threeSet.Add(3); var solution = new ReachabilitySolver().ComputeWinningRegionZero(new ReachabilityGame(arena, threeSet)); Assert.IsTrue(solution.getWinningRegion().Count == 1 && solution.getWinningRegion().Contains(3)); Assert.IsTrue(!solution.getStrategy().HasNextMove(0)); Assert.IsTrue(!solution.getStrategy().HasNextMove(1)); Assert.IsTrue(!solution.getStrategy().HasNextMove(2)); Assert.IsTrue(!solution.getStrategy().HasNextMove(3)); }
public static void CreateGobs(IEnumerable<CanonicalString> typeNames, Arena arena, Vector2 pos, Action<Gob> init = null) { foreach (var typeName in typeNames) { Gob.CreateGob<Gob>(arena.Game, typeName, gob => { gob.ResetPos(pos, Vector2.Zero, Gob.DEFAULT_ROTATION); if (init != null) init(gob); arena.Gobs.Add(gob); }); } }
public void ProcessSetupArenaCommand_TwoSingleDigitNumbersSeperatedBySpaceSupplied_SetArena() { //Arrange var arena = new Arena(latitude, longitude); this.arenaBuilder.Setup(ab => ab.Create(It.IsAny<uint>(), It.IsAny<uint>())).Returns(arena); //Act this.createArenaCommandReader.Process(string.Format("{0} {1}", latitude, longitude)); //Assert Assert.AreSame(arena, this.context.Object.Arena); }
public void Setup() { _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _arena = new Arena(); _source = new Gob { ID = 1, Owner = _player1, MaxDamageLevel = 100, Arena = _arena, Pos = Vector2.Zero }; _hostileGob1 = new Gob { ID = 2, Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _hostileGob2 = new Gob { ID = 3, Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _neutralGob = new Gob { ID = 4, Owner = null, MaxDamageLevel = 100, Arena = _arena }; _friendlyGob = new Gob { ID = 5, Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _targetSelector = new TargetSelector(700); }
public override void TakeTurn(Arena.FightState state) { NewLinked<Team> enemyTeams = GetTargets(state); Team targetTeam = enemyTeams.Get(Randomizer.RandomNumber(enemyTeams.Length)); Utility.NewLinked<Character> targets = new Utility.NewLinked<Character>(); for (int i = 0; i < targetTeam.Members.Length; i++) if (!targetTeam.Members[i].IsDead) targets.Add(targetTeam.Members[i]); Character target = targets.Get(Randomizer.RandomNumber(targets.Length)); Attack(target, state); if (target is Player) { Thread.Sleep(1000); } }
/// <summary> /// Constructor. /// </summary> public PauseMenuScreen(Arena.Screens.RunNJumpGameScreen screen) : base("Paused") { // Create our menu entries. MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game"); MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game"); this.screen = screen; // Hook up menu event handlers. resumeGameMenuEntry.Selected += OnCancel; quitGameMenuEntry.Selected += QuitGameMenuEntrySelected; //resumeGameMenuEntry.Selected += ResumeGameMenuEntrySelected; // Add entries to the menu. MenuEntries.Add(resumeGameMenuEntry); MenuEntries.Add(quitGameMenuEntry); }
protected override Task OnExecute(Arena arena) { Console.WriteLine("ResetAction"); var playerCount = arena.State.Players.Count; if (playerCount != positions.Length) { throw new Exception("Arena state changed!"); } for (var i = 0; i < playerCount; i++) { arena.State.PlayerStates[arena.State.Players[i]].Position = positions[i]; } return TaskDone.Done; }
protected override Task OnPrepare(Arena arena) { var set = new HashSet<Hex>(); var size = arena.State.Terrain.Size; var playerCount = arena.State.Players.Count; while (set.Count < playerCount) { var q = new Random(Guid.NewGuid().GetHashCode()).Next(-size, size); var r = new Random(Guid.NewGuid().GetHashCode()).Next(-size, size); set.Add(new Hex(q, r)); } positions = set.ToArray(); return TaskDone.Done; }
public void Setup() { CanonicalString.IsForLocalUseOnly = true; Spectator.CreateStatsData = spectator => new MockStats(); _arena = new Arena(); _ship1 = new Ship((CanonicalString)"Bugger") { Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _ship2 = new Ship((CanonicalString)"Bugger") { Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _ship3 = new Ship((CanonicalString)"Bugger") { Owner = _player3, MaxDamageLevel = 100, Arena = _arena }; _avengers = new Team("Avengers", null); _xmen = new Team("X-Men", null); _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); SeizeShip(_player1, _ship1); SeizeShip(_player2, _ship2); SeizeShip(_player3, _ship3); }
/// <summary> /// Positions a minion (e.g. a ship) using any of the spawn areas in the arena. /// </summary> public static void PositionNewMinion(Gob minion, Arena arena) { Func<IGeomPrimitive, int, IEnumerable<Vector2>> getRandomPoses = (area, count) => Enumerable.Range(0, count) .Select(x => arena.GetFreePosition(LARGE_GOB_PHYSICAL_RADIUS, area)); var spawnPoses = arena.Gobs.All<SpawnPlayer>() .SelectMany(spawn => getRandomPoses(spawn._spawnArea, 5)); var poses = spawnPoses.Any() ? spawnPoses : getRandomPoses(new Rectangle(Vector2.Zero, arena.Dimensions), 20); var posesWithThreats = poses .Select(pos => new { pos, mood = GetMood(minion, pos) }) .ToList() .OrderByDescending(x => x.mood) .ToList(); var bestMood = posesWithThreats[0].mood; var bestSpawns = posesWithThreats.TakeWhile(x => x.mood == bestMood).ToList(); var bestPos = bestSpawns[RandomHelper.GetRandomInt(bestSpawns.Count)].pos; minion.ResetPos(bestPos, Vector2.Zero, Gob.DEFAULT_ROTATION); }
public void Setup() { Spectator.CreateStatsData = spectator => new MockStats(); Coroner.ResetPhraseSets(); _avengers = new Team("Avengers", null); _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player4 = new Player(null, "Player 4", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player1.AssignTeam(_avengers); _player4.AssignTeam(_avengers); _arena = new Arena(); _gob1 = new Gob { Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob1DamagedBy2 = new Gob { Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob2 = new Gob { Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _gob2Nature = new Gob { Owner = null }; _gob4 = new Gob { Owner = _player4, MaxDamageLevel = 100, Arena = _arena }; _arena.TotalTime = TimeSpan.FromSeconds(10); _gob1DamagedBy2.InflictDamage(10, new DamageInfo(_gob2)); }
public void Setup() { _arena = new Arena(); _avengers = new Team("Avengers", null); _player1 = new Player(null, "Player 1", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2 = new Player(null, "Player 2", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player3 = new Player(null, "Player 3", CanonicalString.Null, CanonicalString.Null, CanonicalString.Null, new UI.PlayerControls()); _player2.AssignTeam(_avengers); _player3.AssignTeam(_avengers); _gob1 = new Gob { ID = 10, Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob1DamagedBy2 = new Gob { ID = 11, Owner = _player1, MaxDamageLevel = 100, Arena = _arena }; _gob2 = new Gob { ID = 2, Owner = _player2, MaxDamageLevel = 100, Arena = _arena }; _gob3 = new Gob { ID = 3, Owner = _player3, MaxDamageLevel = 100, Arena = _arena }; _gobNature = new Gob { ID = 4, Owner = null, MaxDamageLevel = 100, Arena = _arena }; _info1Hit1 = new DamageInfo(_gob1).Bind(_gob1); _info2Hit1 = new DamageInfo(_gob2).Bind(_gob1); _info3Hit2 = new DamageInfo(_gob3).Bind(_gob2); _infoNatureHit1 = new DamageInfo(_gobNature).Bind(_gob1); _arena.TotalTime = TimeSpan.FromSeconds(10); _gob1DamagedBy2.InflictDamage(10, new DamageInfo(_gob2)); _info1DamagedBy2 = DamageInfo.Unspecified.Bind(_gob1DamagedBy2); }
public void CPreOneTest() { var arena = new Arena(); arena.AddPlayerZeroNode(0); arena.AddPlayerOneNode(1); arena.AddPlayerZeroNode(2); arena.AddEdge(0, 1); arena.AddEdge(1, 2); arena.AddEdge(1, 1); arena.AddEdge(2, 0); var zeroSet = new HashSet<int>(); zeroSet.Add(0); var oneSet = new HashSet<int>(); oneSet.Add(1); var twoSet = new HashSet<int>(); twoSet.Add(2); Assert.IsTrue(arena.CPreOne(oneSet).getWinningRegion().Count == 2 && arena.CPreOne(oneSet).getWinningRegion().Contains(1) && arena.CPreOne(oneSet).getWinningRegion().Contains(0)); Assert.IsTrue(arena.CPreOne(twoSet).getWinningRegion().Count == 1 && arena.CPreOne(twoSet).getWinningRegion().Contains(1)); }
public void ZeroAttractorTest() { var arena = new Arena() .AddPlayerZeroNode(0) .AddPlayerOneNode(1) .AddPlayerZeroNode(2) .AddEdge(0, 1) .AddEdge(1, 2) .AddEdge(1, 1) .AddEdge(2, 0); var zeroSet = new HashSet<int>(); zeroSet.Add(0); var oneSet = new HashSet<int>(); oneSet.Add(1); var twoSet = new HashSet<int>(); twoSet.Add(2); Assert.IsTrue(arena.ZeroAttractor(zeroSet).getWinningRegion().Count == 2 && arena.ZeroAttractor(zeroSet).getWinningRegion().Contains(0) && arena.ZeroAttractor(zeroSet).getWinningRegion().Contains(2)); }
public void Setup() { this.arena = new Arena(); }
public static Team GetEntity(string fullName, string shortName, int apiId, string shirtUrl, Arena arena) { return(Team.Create(fullName, shortName, apiId, shirtUrl, arena)); }
public static void Main(string[] args) { var arena = new Arena(); arena.Listen(30100); }
public override void SmoothJitterOnClient(Arena.GobUpdateData data) { var oldDrawRotationOffset = DrawRotationOffset; base.SmoothJitterOnClient(data); if (LocationPredicter == null) return; LocationPredicter.UpdateOldShipLocation(new ShipLocationEntry { GameTime = Game.DataEngine.ArenaTotalTime - AssaultWingCore.TargetElapsedTime.Multiply(data.FramesAgo), Pos = Pos, Move = Move, Rotation = Rotation, ControlStates = null, }); DrawRotationOffset = AWMathHelper.GetAbsoluteMinimalEqualAngle(oldDrawRotationOffset + data.OldRotation - Rotation); if (float.IsNaN(DrawRotationOffset) || Math.Abs(DrawRotationOffset) > Gob.ROTATION_SMOOTHING_CUTOFF) DrawRotationOffset = 0; }
private void successCallback(JSONObject json) { var oldArena = arena; arena = json.GetValue<Arena>("arena"); var updateDelta = (arena.lastRefreshDateTime - lastUpdate).TotalSeconds; lastUpdate = arena.lastRefreshDateTime; var bots = json.GetValues<Bot>("bots"); refreshBots(bots); if (oldArena == null || (oldArena.Width != arena.Width && oldArena.Height != arena.Height) || updateDelta > 3) { initialize(); } }
public ProcessingContext(Arena arena, IList <Bot> bots) { Arena = arena; Bots = bots; }
public static void StartArena(Arena arena) { arenas.Add(arena); }
private bool ShouldShow(Arena.Core.Person arena, string name) { // First we check to see if this is yourself if (Arena.Core.ArenaContext.Current.Person.PersonID == arena.PersonID) { return true; } // Next we check to see if this is a family member if (Arena.Core.ArenaContext.Current.Person.FamilyId == arena.FamilyId) { return true; } // Group Leader Check - If the person they are fetching is one of their // small group members, go ahead and provide visibility Arena.Custom.SECC.Data.SmallGroup.GroupCollection gc = new Arena.Custom.SECC.Data.SmallGroup.GroupCollection(); gc.LoadByLeaderPersonID(Arena.Core.ArenaContext.Current.Person.PersonID); foreach (Arena.SmallGroup.Group g in gc) { foreach (Arena.Core.Person groupMember in g.Members) { if (groupMember.PersonID == arena.PersonID) { return true; } } Arena.SmallGroup.GroupCluster cluster = g.GroupCluster; while (cluster != null) { // If this is the current group's cluster leader or admin if (cluster.LeaderID == arena.PersonID || cluster.AdminID == arena.PersonID) { return true; } if (cluster.ParentClusterID > 0) { cluster = new Arena.SmallGroup.GroupCluster(cluster.ParentClusterID); } else { cluster = null; } } } if (!PersonMapper._fieldSecurityMap.ContainsKey(name.ToUpperInvariant())) { return false; } PermissionCollection permissionCollection = new PermissionCollection(ObjectType.PersonField, PersonMapper._fieldSecurityMap[name.ToUpperInvariant()]); if (!permissionCollection.Allowed(OperationType.View, Arena.Core.ArenaContext.Current.User)) { return false; } if (this._includeFields == null) { return true; } return this._includeFields.Contains(name.ToUpperInvariant()); }
/// <summary> /// Constructor for an OvD object. /// </summary> /// <param name="TheArena">The arena object</param> public OvD(Arena TheArena) { _arena = TheArena; _Offense = new OvdTeam(_arena, _arena.getTeamByName(_OffenseTeamName)); _Defense = new OvdTeam(_arena, _arena.getTeamByName(_DefenseTeamName)); }
private List <Player> _InviteList = new List <Player>(); // Anyone who has been ?invited /// <summary> /// Constructor for an OvD team, either offense or defense. /// </summary> /// <param name="TheArena">The arena object</param> /// <param name="TheTeam">The team to use </param> public OvdTeam(Arena TheArena, Team TheTeam) { _arena = TheArena; _Team = TheTeam; }
public void Setup() { this.arena = new Arena(); this.attacker = new Warrior("Pesho", 10, 80); this.deffender = new Warrior("Peter", 5, 50); }
public void ConstructorWorkCorectly() { this.warriors = new Arena(); Assert.AreEqual(0, this.warriors.Count); }
public void Setup() { this.warriors = new Arena(); }
Matrix[] mSpherePositionBuffer; // cache for model matrices of all simulated spheres #endregion Fields #region Constructors public BounceGame() { mGraphicsManager = new GraphicsDeviceManager(this); // define USE_PERFHUD to enable the use of perfhud on nvidia graphics cards #if USE_PERFHUD mGraphicsManager.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings); #endif Content.RootDirectory = "Content"; mPlayer = new Player(); mArena = new Arena(); mRenderer = new Renderer(); // default window size mGraphicsManager.PreferredBackBufferWidth = 1280; mGraphicsManager.PreferredBackBufferHeight = 720; mGraphicsManager.PreferMultiSampling = true; // predefined light positions mLightPositions = new Vector3[3]; mLightPositions[0] = new Vector3(843, 1986, -55); mLightPositions[1] = new Vector3(1865, 121, -21); mLightPositions[2] = new Vector3(0, 20, 00); mLightRotationY = 0.0f; // init player position and orientation to sensitive defaults mPlayer.position = new Vector3(0, 10, 0); mPlayer.rotationX = -0.0610865131f; mPlayer.rotationY = -1.6057024f; mSpherePositionBuffer = new Matrix[MaximumSimulatedSpheres]; mOverlay = new Overlay(); mCollidingFacesBuffer = new Dictionary<Face, uint>(); }
public Arena InsertOrUpdateArena(Arena arena) { var a = new InsertOrUpdateArenaCommand(arena).Execute(Context); return(a); }
public Arena.Services.Contracts.Person FromArena(Arena.Core.Person arena) { Arena.Services.Contracts.Person person = new Arena.Services.Contracts.Person(); if (this.ShouldShow(arena, "PersonID")) { person.PersonID = new int?(arena.PersonID); } if (this.ShouldShow(arena, "PersonGUID")) { person.PersonGUID = new Guid?(arena.PersonGUID); } if (this.ShouldShow(arena, "PersonLink")) { Guid personGUID = arena.PersonGUID; person.PersonLink = string.Format("person/{0}", personGUID.ToString()); } if (this.ShouldShow(arena, "OrganizationID")) { person.OrganizationID = new int?(arena.OrganizationID); } if (arena.Campus != null && this.ShouldShow(arena, "CampusID")) { person.CampusID = new int?(arena.Campus.CampusId); } if (arena.Campus != null && this.ShouldShow(arena, "CampusName")) { person.CampusName = arena.Campus.Name; } if (this.ShouldShow(arena, "TitleID")) { person.TitleID = new int?(arena.Title.LookupID); } if (this.ShouldShow(arena, "TitleValue")) { person.TitleValue = arena.Title.ToString(); } if (this.ShouldShow(arena, "SuffixID")) { person.SuffixID = new int?(arena.Suffix.LookupID); } if (this.ShouldShow(arena, "SuffixValue")) { person.SuffixValue = arena.Suffix.ToString(); } if (this.ShouldShow(arena, "NickName")) { person.NickName = arena.NickName; } if (this.ShouldShow(arena, "FirstName")) { person.FirstName = arena.FirstName; } if (this.ShouldShow(arena, "MiddleName")) { person.MiddleName = arena.MiddleName; } if (this.ShouldShow(arena, "LastName")) { person.LastName = arena.LastName; } if (this.ShouldShow(arena, "FullName")) { person.FullName = arena.FullName; } if (this.ShouldShow(arena, "FamilyID")) { person.FamilyID = new int?(arena.FamilyId); } if (this.ShouldShow(arena, "FamilyName")) { person.FamilyName = arena.Family().FamilyName; } if (this.ShouldShow(arena, "FamilyLink")) { int? familyID = person.FamilyID; person.FamilyLink = string.Format("family/{0}", familyID.ToString()); } if (this.ShouldShow(arena, "Age")) { person.Age = new int?(arena.Age); } if (this.ShouldShow(arena, "Gender")) { person.Gender = arena.Gender.ToString(); } if (this.ShouldShow(arena, "Notes")) { person.Notes = arena.Notes; } if (this.ShouldShow(arena, "MedicalInformation")) { person.MedicalInformation = arena.MedicalInformation; } if (this.ShouldShow(arena, "EnvelopeNumber")) { person.EnvelopeNumber = new int?(arena.EnvelopeNumber); } if (this.ShouldShow(arena, "IncludeOnEnvelope")) { person.IncludeOnEnvelope = new bool?(arena.IncludeOnEnvelope); } if (this.ShouldShow(arena, "MaritalStatusID")) { person.MaritalStatusID = new int?(arena.MaritalStatus.LookupID); } if (this.ShouldShow(arena, "MaritalStatusValue")) { person.MaritalStatusValue = arena.MaritalStatus.ToString(); } if (this.ShouldShow(arena, "AnniversaryDate")) { person.AnniversaryDate = new DateTime?(arena.AnniversaryDate); } if (this.ShouldShow(arena, "MemberStatusID")) { person.MemberStatusID = new int?(arena.MemberStatus.LookupID); } if (this.ShouldShow(arena, "MemberStatusValue")) { person.MemberStatusValue = arena.MemberStatus.ToString(); } if (this.ShouldShow(arena, "RecordStatusID")) { person.RecordStatusID = new int?(Convert.ToInt32(arena.RecordStatus)); } if (this.ShouldShow(arena, "RecordStatusValue")) { person.RecordStatusValue = arena.RecordStatus.ToString(); } if (this.ShouldShow(arena, "InactiveReasonID")) { person.InactiveReasonID = new int?(arena.InactiveReason.LookupID); } if (this.ShouldShow(arena, "InactiveReasonValue")) { person.InactiveReasonValue = arena.InactiveReason.ToString(); } if (this.ShouldShow(arena, "ActiveMeter")) { person.ActiveMeter = new int?(arena.ActiveMeter); } if (this.ShouldShow(arena, "ContributeIndividually")) { person.ContributeIndividually = new bool?(arena.ContributeIndividually); } if (this.ShouldShow(arena, "PrintStatement")) { person.PrintStatement = new bool?(arena.PrintStatement); } if (this.ShouldShow(arena, "EmailStatement")) { person.EmailStatement = new bool?(arena.EmailStatement); } if (this.ShouldShow(arena, "RegionName")) { person.RegionName = arena.RegionName; } if (this.ShouldShow(arena, "BlobID")) { person.BlobID = new int?(arena.BlobID); } if (this.ShouldShow(arena, "BlobLink")) { if (arena.BlobID > 0) { Guid gUID = arena.Blob.GUID; person.BlobLink = base.BuildBlobUrl(gUID.ToString(), -1, Gender.Unknown); } } if (this.ShouldShow(arena, "GivingUnitID")) { person.GivingUnitID = arena.GivingUnitID; } if (this.ShouldShow(arena, "ForeignKey")) { person.ForeignKey = new int?(arena.ForeignKey); } if (this.ShouldShow(arena, "ForeignKey2")) { person.ForeignKey2 = new int?(arena.ForeignKey2); } if (this.ShouldShow(arena, "Addresses")) { foreach (Arena.Core.PersonAddress arenaAddress in arena.Addresses) { Address address = new Address() { AddressID = arenaAddress.AddressID, StreetLine1 = arenaAddress.Address.StreetLine1, StreetLine2 = arenaAddress.Address.StreetLine2, City = arenaAddress.Address.City, State = arenaAddress.Address.State, PostalCode = arenaAddress.Address.PostalCode, Country = arenaAddress.Address.Country }; if (arenaAddress.AddressType != null && arenaAddress.AddressType.LookupID != -1) { address.AddressTypeValue = arenaAddress.AddressType.Value; address.AddressTypeID = arenaAddress.AddressType.LookupID; } if (arenaAddress.Address.Latitude != 0) { address.Latitude = new double?(arenaAddress.Address.Latitude); } if (arenaAddress.Address.Longitude != 0) { address.Longitude = new double?(arenaAddress.Address.Longitude); } address.Primary = arenaAddress.Primary; person.AddAddress(address); } } if (this.ShouldShow(arena, "Phones")) { foreach (Arena.Core.PersonPhone arenaPhone in arena.Phones) { Arena.Services.Contracts.Phone phone = new Arena.Services.Contracts.Phone() { PhoneTypeID = arenaPhone.PhoneType.LookupID, PhoneTypeValue = arenaPhone.PhoneType.Value, Unlisted = arenaPhone.Unlisted, SMSEnabled = arenaPhone.SMSEnabled, Extension = arenaPhone.Extension, Number = arenaPhone.Number }; person.AddPhone(phone); } } if (this.ShouldShow(arena, "AttributesLink")) { Guid? nullable = person.PersonGUID; person.AttributesLink = string.Format("person/{0}/attribute/list", nullable.ToString()); } if (this.ShouldShow(arena, "NotesLink")) { Guid? personGUID1 = person.PersonGUID; person.NotesLink = string.Format("person/{0}/note/list", personGUID1.ToString()); } if (this.ShouldShow(arena, "BirthDate")) { person.BirthDate = new DateTime?(arena.BirthDate); } Arena.Core.Family family = null; if (this.ShouldShow(arena, "FamilyMemberRoleID")) { if (family == null) { family = arena.Family(); } if (family.FamilyID != -1) { person.FamilyMemberRoleID = new int?(family.FamilyMembers.FindByID(arena.PersonID).FamilyRole.LookupID); } } if (this.ShouldShow(arena, "FamilyMemberRoleValue")) { if (family == null) { family = arena.Family(); } if (family.FamilyID != -1) { person.FamilyMemberRoleValue = family.FamilyMembers.FindByID(arena.PersonID).FamilyRole.Value; } } if (this.ShouldShow(arena, "DateCreated")) { person.DateCreated = new DateTime?(arena.DateCreated); } if (this.ShouldShow(arena, "DateModified")) { person.DateModified = new DateTime?(arena.DateModified); } if (this.ShouldShow(arena, "AreaID") && arena.Area != null) { person.AreaID = new int?(arena.Area.AreaID); } if (this.ShouldShow(arena, "AreaName") && arena.Area != null) { person.AreaName = arena.Area.Name; } if (this.ShouldShow(arena, "Emails")) { foreach (Arena.Core.PersonEmail active in arena.Emails.Active) { person.AddEmail(new Email() { Address = active.Email }); } } if (this.ShouldShow(arena, "DisplayNotesCount")) { person.DisplayNotesCount = new int?(arena.GetDisplayNotes(Arena.Core.ArenaContext.Current.Organization.OrganizationID, Arena.Core.ArenaContext.Current.User.Identity.Name).Count); } if (this.ShouldShow(arena, "FamilyMembersCount")) { if (family == null) { family = arena.Family(); } person.FamilyMembersCount = new int?(family.FamilyMembers.Count); } return person; }
public Spell(int _Type, Arena _UnlockArena, int _Rarity) { this.Type = _Type; this.UnlockArena = _UnlockArena; this.Rarity = _Rarity; }
public void selectArena(string name) { this.selectedArena = name; arena = null; CleanAllBots(); refreshGrid(); }
public void Setup() { arena = new Arena(); }
// Use this for initialization void Start() { Global.Instance.CurrentScene = SceneManager.GetActiveScene().name; mouseTilePos = new Position(0, 0); arena = new Arena(mapsize, 0.32f); turns = new List<BattleEntityClient>(); entities = new Dictionary<int, BattleEntityClient>(); trainerActions = new List<Action>(); trainerActions.Add(TrainerActions.Get(TrainerAction.End_Battle)); trainerActions.Add(TrainerActions.Get(TrainerAction.Pokemon_Go)); trainerActions.Add(TrainerActions.Get(TrainerAction.Pokemon_Come_Back)); trainerActions.Add(TrainerActions.Get(TrainerAction.Pokeball)); hover = GameObject.Instantiate(Resources.Load("hover")) as GameObject; hover.SetActive(false); Camera camera = GetComponent<Camera>(); camera.orthographicSize = 2; gameObject.transform.position = new Vector3(tilesize * (arena.ArenaSize - 1) / 2, -tilesize * (arena.ArenaSize - 1) / 2, gameObject.transform.position.z); gameObject.transform.position = new Vector3(gameObject.transform.position.x + 1, gameObject.transform.position.y - 0.35f, gameObject.transform.position.z); highlightRange = new List<GameObject>(); highlightAOE = new List<GameObject>(); displayGUI(); isCurrentActionTrainer = false; isPokemonGoAction = false; isPokemonGoSelection = false; currentActionInt = -1; //HighlightAction(playerTurn); }
public ActivePlayer(Player player) { this.player = player; arena = Arena.instance; }
public async Task RegisterOutputTestAsync() { var config = new WabiSabiConfig { MaxInputCountByRound = 1 }; var round = WabiSabiFactory.CreateRound(config); using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, round); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); var km = ServiceFactory.CreateKeyManager(""); var key = BitcoinFactory.CreateHdPubKey(km); SmartCoin coin1 = BitcoinFactory.CreateSmartCoin(key, Money.Coins(2m)); var outpoint = coin1.OutPoint; var mockRpc = new Mock <IRPCClient>(); mockRpc.Setup(rpc => rpc.GetTxOutAsync(outpoint.Hash, (int)outpoint.N, true)) .ReturnsAsync(new NBitcoin.RPC.GetTxOutResponse { IsCoinBase = false, Confirmations = coin1.Height, TxOut = coin1.TxOut, }); CredentialPool amountCredential = new(); CredentialPool weightCredential = new(); await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object); var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.WeightCredentialIssuerParameters, amountCredential, weightCredential, coordinator, new InsecureRandom()); var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.WeightCredentialIssuerParameters, amountCredential, weightCredential, coordinator, new InsecureRandom()); Assert.Equal(Phase.InputRegistration, round.Phase); var bitcoinSecret = km.GetSecrets("", coin1.ScriptPubKey).Single().PrivateKey.GetBitcoinSecret(Network.Main); var aliceClient = await AliceClient.CreateNewAsync(aliceArenaClient, new[] { coin1.Coin }, bitcoinSecret, round.Id, round.Hash, round.FeeRate); Task confirmationTask = aliceClient.ConfirmConnectionAsync(TimeSpan.FromSeconds(3), CancellationToken.None); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); await confirmationTask; Assert.Equal(Phase.ConnectionConfirmation, round.Phase); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); Assert.Equal(Phase.OutputRegistration, round.Phase); using var destinationKey1 = new Key(); using var destinationKey2 = new Key(); using var destinationKey3 = new Key(); using var destinationKey4 = new Key(); var bobClient = new BobClient(round.Id, bobArenaClient); await bobClient.RegisterOutputAsync(Money.Coins(0.25m), destinationKey1.PubKey.WitHash.ScriptPubKey); await bobClient.RegisterOutputAsync(Money.Coins(0.25m), destinationKey2.PubKey.WitHash.ScriptPubKey); await bobClient.RegisterOutputAsync(Money.Coins(0.25m), destinationKey3.PubKey.WitHash.ScriptPubKey); await bobClient.RegisterOutputAsync(Money.Coins(0.25m), destinationKey4.PubKey.WitHash.ScriptPubKey); Assert.Equal(4, round.Bobs.Count); }
private void UpdateOrAddArenaLayout(Arena arena, ArenaLayout arenaLayout, XDocument xmlDocument) { var arenas = xmlDocument.Root.Element(XmlNames.lobby_data_ndl).Element(XmlNames.arenas).Elements(XmlNames.arena).ToArray(); }
protected override Task OnExecute(Arena arena) { arena.State.PlayerStates[Player].Position += Offset; return TaskDone.Done; }
public void Setup() { this.arena = new Arena(); this.someWarrior = new Warrior("Pesho", 50, 100); }
public OAuthAuthorization FromArena(Arena.Custom.SECC.OAuth.ClientAuthorization dbAuthorization) { OAuthAuthorization authorization = new OAuthAuthorization(); authorization.AuthorizationId = dbAuthorization.AuthorizationId; authorization.ClientId = dbAuthorization.ClientId; authorization.LoginId = dbAuthorization.LoginId; authorization.ScopeId = dbAuthorization.ScopeId; authorization.ScopeIdentifier = dbAuthorization.ScopeIdentifier; authorization.ScopeDescription = dbAuthorization.ScopeDescription; authorization.Active = dbAuthorization.Active; return authorization; }
public const bool chargeOccludedPlayers = false; //do we charge occluded players? /////////////////////////////////////////////////// // Member Functions /////////////////////////////////////////////////// /// <summary> /// Generic constructor /// </summary> public EnergizerBotTurret(VehInfo.Computer type, Arena arena) : base(type, arena) { }
public async Task DiffTooSmallToBlameAsync() { WabiSabiConfig cfg = new() { MaxInputCountByRound = 2, MinInputCountByRoundMultiplier = 0.5, OutputRegistrationTimeout = TimeSpan.Zero }; using Key key1 = new(); using Key key2 = new(); var coin1 = WabiSabiFactory.CreateCoin(key1); var coin2 = WabiSabiFactory.CreateCoin(key2); var mockRpc = WabiSabiFactory.CreatePreconfiguredRpcClient(coin1, coin2); using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(cfg, mockRpc); var(round, arenaClient, alices) = await CreateRoundWithTwoConfirmedConnectionsAsync(arena, key1, coin1, key2, coin2).ConfigureAwait(false); var(realAmountCredentials1, realVsizeCredentials1) = alices[0]; var(realAmountCredentials2, realVsizeCredentials2) = alices[1]; // Register outputs. var bobClient = new BobClient(round.Id, arenaClient); using var destKey1 = new Key(); using var destKey2 = new Key(); await bobClient.RegisterOutputAsync( coin1.Amount - round.FeeRate.GetFee(coin1.ScriptPubKey.EstimateInputVsize()), destKey1.PubKey.WitHash.ScriptPubKey, realAmountCredentials1, realVsizeCredentials1, CancellationToken.None).ConfigureAwait(false); await bobClient.RegisterOutputAsync( coin2.Amount - round.FeeRate.GetFee(coin2.ScriptPubKey.EstimateInputVsize()), destKey2.PubKey.WitHash.ScriptPubKey, realAmountCredentials2, realVsizeCredentials2, CancellationToken.None).ConfigureAwait(false); // Add another input. The input must be able to pay for itself, but // the remaining amount after deducting the fees needs to be less // than the minimum. var txParams = round.Assert <ConstructionState>().Parameters; var extraAlice = WabiSabiFactory.CreateAlice(txParams.FeeRate.GetFee(Constants.P2wpkhInputVirtualSize) + txParams.AllowedOutputAmounts.Min - new Money(1L)); round.Alices.Add(extraAlice); round.CoinjoinState = round.Assert <ConstructionState>().AddInput(extraAlice.Coin); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromSeconds(21)); Assert.Equal(Phase.TransactionSigning, round.Phase); var tx = round.Assert <SigningState>().CreateTransaction(); Assert.Equal(3, tx.Inputs.Count); Assert.Equal(2, tx.Outputs.Count); Assert.DoesNotContain(cfg.BlameScript, tx.Outputs.Select(x => x.ScriptPubKey)); await arena.StopAsync(CancellationToken.None); }
public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider) { if (dbContext.Arenas.Any()) { return; } var bulgariaId = await dbContext.Countries.Where(c => c.Name == "Bulgaria").Select(c => c.Id).FirstAsync(); // Sofia arenas(5) var sofiaId = await dbContext.Cities.Where(c => c.Name == "Sofia").Select(c => c.Id).FirstAsync(); var arenaAdminRoleId = await dbContext.Roles.Where(r => r.Name == ArenaAdminRoleName).Select(r => r.Id).FirstAsync(); var arenaArmeets = new Arena { Name = "Arena Armeets", Email = "*****@*****.**", WebUrl = "www.arena-armeets.bg", PhoneNumber = "0878112233", SportId = await dbContext.Sports.Where(s => s.Name == "Basketball").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == sofiaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).FirstAsync(), Address = "Chetvarti Kilometar", Description = "Indoor sports", PricePerHour = 1200, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = sofiaId, }; var vasilLevski = new Arena { Name = "Vasil Levski", Email = "*****@*****.**", WebUrl = "www.national-stadium.bg", PhoneNumber = "0888226677", SportId = await dbContext.Sports.Where(s => s.Name == "Football").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == sofiaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).Skip(1).FirstAsync(), Address = "Evlogi Georgiev blvd.", Description = "Outdoor sports", PricePerHour = 1400, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = sofiaId, }; var diana = new Arena { Name = "Diana Pool", Email = "*****@*****.**", WebUrl = "www.diana-pool.bg", PhoneNumber = "0886998822", SportId = await dbContext.Sports.Where(s => s.Name == "Aquatics").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == sofiaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).Skip(2).FirstAsync(), Address = "1 Tintyava str", Description = "Indoor pools", PricePerHour = 25, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = sofiaId, }; var universiada = new Arena { Name = "Universiada", Email = "*****@*****.**", WebUrl = "www.universiada.bg", PhoneNumber = "0886998866", SportId = await dbContext.Sports.Where(s => s.Name == "Volleyball").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == sofiaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).Skip(3).FirstAsync(), Address = "1 Shipchenski prohod blvd.", Description = "Indoor sports", PricePerHour = 600, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = sofiaId, }; var triaditsa = new Arena { Name = "Triaditsa", Email = "*****@*****.**", WebUrl = "www.triaditsa.bg", PhoneNumber = "0886123456", SportId = await dbContext.Sports.Where(s => s.Name == "Boxing").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == sofiaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).Skip(4).FirstAsync(), Address = "Gotse Delchev", Description = "Indoor sports", PricePerHour = 400, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = sofiaId, }; // Plovdiv (2) var polovdivId = await dbContext.Cities.Where(c => c.Name == "Plovdiv").Select(c => c.Id).FirstAsync(); var kolodruma = new Arena { Name = "Kolodruma", Email = "*****@*****.**", WebUrl = "www.kolodruma.bg", PhoneNumber = "0883445566", SportId = await dbContext.Sports.Where(s => s.Name == "Basketball").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == polovdivId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).FirstAsync(), Address = "Asenovgradsko Shose", Description = "Indoor sports", PricePerHour = 800, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = polovdivId, }; var sila = new Arena { Name = "Sila", Email = "*****@*****.**", WebUrl = "www.sila.bg", PhoneNumber = "0883324354", SportId = await dbContext.Sports.Where(s => s.Name == "Volleyball").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == polovdivId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).Skip(1).FirstAsync(), Address = "Vasil Aprilov blvd.", Description = "Indoor sports", PricePerHour = 500, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = polovdivId, }; // Varna var varnaId = await dbContext.Cities.Where(c => c.Name == "Varna").Select(c => c.Id).FirstAsync(); var sportPalace = new Arena { Name = "Dvorets na sporta", Email = "*****@*****.**", WebUrl = "www.sport-palace.bg", PhoneNumber = "0888442233", SportId = await dbContext.Sports.Where(s => s.Name == "Volleyball").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == varnaId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).FirstAsync(), Address = "Knyaz Boris I blvd.", Description = "Indoor sports", PricePerHour = 800, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = varnaId, }; // Burgas var burgasId = await dbContext.Cities.Where(c => c.Name == "Burgas").Select(c => c.Id).FirstAsync(); var burgas = new Arena { Name = "Burgas", Email = "*****@*****.**", WebUrl = "www.burgas-stadium.bg", PhoneNumber = "0884556688", SportId = await dbContext.Sports.Where(s => s.Name == "Football").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == burgasId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).FirstAsync(), Address = "Lazur kv.", Description = "Outdoor sports", PricePerHour = 600, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = burgasId, }; // Ruse var rusesId = await dbContext.Cities.Where(c => c.Name == "Ruse").Select(c => c.Id).FirstAsync(); var ozk = new Arena { Name = "OZK", Email = "*****@*****.**", WebUrl = "www.ozk-arena.bg", PhoneNumber = "0887889922", SportId = await dbContext.Sports.Where(s => s.Name == "Tennis").Select(s => s.Id).FirstAsync(), ArenaAdminId = await dbContext.ApplicationUsers.Where(au => au.CityId == rusesId) .Where(au => au.Roles .Any(r => r.RoleId == arenaAdminRoleId)) .Select(au => au.Id).FirstAsync(), Address = "Lipnik blvd.", Description = "Indoor sports", PricePerHour = 400, Status = (ArenaStatus)1, CountryId = bulgariaId, CityId = rusesId, }; dbContext.Arenas.AddRange( arenaArmeets, vasilLevski, universiada, diana, triaditsa, kolodruma, sila, sportPalace, burgas, ozk); }
public override void Destroy() { instance = null; }
public bool ChooseItem(Arena.FightState state) { bool choseItem = false; Console.WriteLine("You have no items!"); return choseItem; }
private static async Task RegisterAndAssertWrongPhaseAsync(InputRegistrationRequest req, Arena handler) { var ex = await Assert.ThrowsAsync <WabiSabiProtocolException>(async() => await handler.RegisterInputAsync(req, CancellationToken.None)); Assert.Equal(WabiSabiProtocolErrorCode.WrongPhase, ex.ErrorCode); }
public bool ChooseSpecial(Arena.FightState state) { bool choseSpecial = false; Console.WriteLine("No specials available!"); return choseSpecial; }
/// <summary> /// Execute /// The second of the two required methods to implement /// The BotEngine will call this method once each game cycle allowing us /// to implement/execute our robot logic /// </summary> public void Execute() { int range = Arena.Scan(this, 0, 10); }
public bool ConfirmFlee(Arena.FightState state) { bool fled = false; Console.WriteLine("Flee chance will be based on your AT and speed versus the remaining opponents possibly blocking your escape. Are you sure? y/n"); Char input = Input.GetUserAny(); if (input == 'y')//Flee chance calculation goes in here (later) (much later) fled = true; else fled = false; return fled; }
public static void EatBadFood(Agent agent, GameObject foodObject, Arena arena) { agent.AddReward(-0.5f); arena.RemoveSpecificFood(foodObject, -1); }
public async Task FullCoinjoinAsyncTest() { var config = new WabiSabiConfig { MaxInputCountByRound = 1 }; var round = WabiSabiFactory.CreateRound(config); using Arena arena = await WabiSabiFactory.CreateAndStartArenaAsync(config, round); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); using var key = new Key(); var outpoint = BitcoinFactory.CreateOutPoint(); var mockRpc = new Mock <IRPCClient>(); mockRpc.Setup(rpc => rpc.GetTxOutAsync(outpoint.Hash, (int)outpoint.N, true)) .ReturnsAsync(new NBitcoin.RPC.GetTxOutResponse { IsCoinBase = false, Confirmations = 200, TxOut = new TxOut(Money.Coins(1m), key.PubKey.WitHash.GetAddress(Network.Main)), }); await using var coordinator = new ArenaRequestHandler(config, new Prison(), arena, mockRpc.Object); CredentialPool amountCredentials = new(); CredentialPool vsizeCredentials = new(); var aliceArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, coordinator, new InsecureRandom()); var aliceId = await aliceArenaClient.RegisterInputAsync(Money.Coins(1m), outpoint, key, round.Id, round.Hash); Assert.NotEqual(Guid.Empty, aliceId); Assert.Empty(amountCredentials.Valuable); var reissuanceAmounts = new[] { Money.Coins(.75m) - round.FeeRate.GetFee(Constants.P2wpkhInputVirtualSize), Money.Coins(.25m) }; var inputVsize = Constants.P2wpkhInputVirtualSize; var inputRemainingVsizes = new[] { ProtocolConstants.MaxVsizePerAlice - inputVsize }; // Phase: Input Registration Assert.Equal(Phase.InputRegistration, round.Phase); await aliceArenaClient.ConfirmConnectionAsync( round.Id, aliceId, inputRemainingVsizes, amountCredentials.ZeroValue.Take(ProtocolConstants.CredentialNumber), reissuanceAmounts); Assert.Empty(amountCredentials.Valuable); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); Assert.Equal(Phase.ConnectionConfirmation, round.Phase); // Phase: Connection Confirmation await aliceArenaClient.ConfirmConnectionAsync( round.Id, aliceId, inputRemainingVsizes, amountCredentials.ZeroValue.Take(ProtocolConstants.CredentialNumber), reissuanceAmounts); Assert.Single(amountCredentials.Valuable, x => x.Amount.ToMoney() == reissuanceAmounts.First()); Assert.Single(amountCredentials.Valuable, x => x.Amount.ToMoney() == reissuanceAmounts.Last()); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); Assert.Equal(Phase.OutputRegistration, round.Phase); var bobArenaClient = new ArenaClient(round.AmountCredentialIssuerParameters, round.VsizeCredentialIssuerParameters, amountCredentials, vsizeCredentials, coordinator, new InsecureRandom()); Assert.Equal(4, amountCredentials.ZeroValue.Count()); // Phase: Output Registration using var destinationKey1 = new Key(); using var destinationKey2 = new Key(); var result = await bobArenaClient.ReissueCredentialAsync( round.Id, reissuanceAmounts[0], destinationKey1.PubKey.WitHash.ScriptPubKey, reissuanceAmounts[1], destinationKey2.PubKey.WitHash.ScriptPubKey, amountCredentials.Valuable, vsizeCredentials.Valuable); Assert.Equal(6, amountCredentials.ZeroValue.Count()); Assert.Equal(6, vsizeCredentials.ZeroValue.Count()); Credential amountCred1 = result.RealAmountCredentials.ElementAt(0); Credential amountCred2 = result.RealAmountCredentials.ElementAt(1); Credential vsizeCred1 = result.RealVsizeCredentials.ElementAt(0); Credential vsizeCred2 = result.RealVsizeCredentials.ElementAt(1); await bobArenaClient.RegisterOutputAsync( round.Id, reissuanceAmounts[0], destinationKey1.PubKey.WitHash.ScriptPubKey, new[] { amountCred1 }, new[] { vsizeCred1 }); await bobArenaClient.RegisterOutputAsync( round.Id, reissuanceAmounts[1], destinationKey2.PubKey.WitHash.ScriptPubKey, new[] { amountCred2 }, new[] { vsizeCred2 }); await arena.TriggerAndWaitRoundAsync(TimeSpan.FromMinutes(1)); Assert.Equal(Phase.TransactionSigning, round.Phase); Assert.Equal(1, round.Coinjoin.Inputs.Count); Assert.Equal(2, round.Coinjoin.Outputs.Count); }