public void initializeTest() { instruct = new InstructionDto(); var advent1 = new Adventurer { PosX = 0, PosY = 0, MovementList = "A", Name = "Indiana", FinishMoving = false, PlayerOrientation = "S", Treasures = 0 }; var advent2 = new Adventurer { PosX = 3, PosY = 3, MovementList = "ADDGA", Name = "Shia", FinishMoving = false, PlayerOrientation = "O", Treasures = 0 }; instruct.adventurer = new List <IAdventurer> { advent1, advent2 }; instruct.mapSizeX = 5; instruct.mapSizeY = 5; var mountain = new Mountain(1, 1) { GotAdventurer = false, tileType = TileType.MOUNTAIN }; var treasure = new Treasure(2, 2, 2) { GotAdventurer = false, tileType = TileType.TREASURE }; instruct.tiles = new List <ITile> { mountain, treasure }; map = new Map(5, 5); loopClassTest = new LoopClass(map); //Assert }
private void OnTriggerEnter2D(Collider2D other) { Adventurer enemy = other.GetComponent <Adventurer>(); if (enemy == null) { return; } //TODO: Fade out and in switch (PossibleStates[currentState]) { case MovementState.UP: enemy.transform.position = UpperTarget.position; break; case MovementState.DOWN: enemy.transform.position = LowerTarget.position; break; } if (roundRobin) { NextState(); } }
IEnumerator SetupBattle() { if (!extracting_simulation_data) { battlesWon = 0; battlesLost = 0; } GameObject playerGO = GameObject.Find("Player"); playerUnit = playerGO.GetComponent <Adventurer>(); playerUnit.currentHP = playerUnit.maxHP; GameObject enemyGO = GameObject.Find("Enemy"); enemyUnit = enemyGO.GetComponent <Adventurer>(); enemyUnit.currentHP = enemyUnit.maxHP; dialogueText.text = "A wild " + enemyUnit.name + " approaches..."; playerHUD.SetHUD(playerUnit); enemyHUD.SetHUD(enemyUnit); if (extracting_simulation_data) { yield return(new WaitForSeconds(0f)); } else { yield return(new WaitForSeconds(2f)); } PlayerTurn(); }
static void Main(string[] args) { DialogHelper.Dialog("Hello Adventurer, please state your name!\n", ConsoleColor.Blue); Adventurer.NameHero(); if (String.IsNullOrEmpty(Adventurer.Name)) { DialogHelper.Dialog("Im sorry traveller i didn't catch your name, what was it again?\n", ConsoleColor.Blue); Adventurer.NameHero(); } DialogHelper.Dialog("Welcome " + Adventurer.Name + ", these are grave times! An evil wizard threatens the lands!!", ConsoleColor.Blue); var acceptTheQuest = AcceptingQuest(); if (acceptTheQuest) { Adventurer.GeneratePlayerStats(); } else { DialogHelper.Dialog("That is a shame, i guess we will have to wait for the next brave adventurer! Farewell Traveller!", ConsoleColor.Blue); Environment.Exit(0); } StartAdventure(); }
void SpawnTheCustomer(int position) { GameObject toSpawn; if (customers.Length > 0) { int randNum = Random.Range(0, customers.Length); // spawn random object from customers array toSpawn = Instantiate(customers[randNum], transform.position, Quaternion.identity); Customer customerScript = toSpawn.GetComponent <Customer>(); if (customerScript != null) // we successfully got the component { customerScript.SetGoal(deployedPositions[position]); } else { Adventurer adventurerScript = toSpawn.GetComponent <Adventurer>(); if (adventurerScript != null) { adventurerScript.SetGoal(deployedPositions[position]); } else { Debug.Log("Spawned an object that doesn't have the correct script oh f**k please don't fire me I need this job"); } } } }
public Adventure(Adventurer adventurer, Remoting.ISoulBinder binder, IZone zone) { _Adventurer = adventurer; _Zone = zone; this._Binder = binder; _Squad = new Squad(adventurer.Formation ,_Adventurer.Teammates, _Adventurer.Controller); }
void PopulateDropdownForMystic() { dd.ClearOptions(); List <Dropdown.OptionData> ddOpts = new List <Dropdown.OptionData>(); List <MysticPromotes> l = new List <MysticPromotes>(); for (int i = 1; i > 1 << 31;) { if (GameDataManager.Instance.MysticPromoteUnlocked((MysticPromotes)i)) { l.Add((MysticPromotes)i); } i = i << 1; } for (int i = 0; i < l.Count; i++) { if (i >= ddOpts.Count) { advClasses.Add(AdventurerClass.None); } advClasses[i] = Adventurer._mysticPromoteToAdvClass(l[i]); ddOpts.Add(new Dropdown.OptionData(Adventurer.GetClassName(advClasses[i]))); } dd.AddOptions(ddOpts); }
public void AddAdventurer(string partyName, [FromBody] Adventurer adventurer) { var party = Parties[partyName]; var updatedParty = addAdventurer(party, adventurer); Parties[partyName] = updatedParty; }
void PopulateDropdownForWarrior() { dd.ClearOptions(); List <Dropdown.OptionData> ddOpts = new List <Dropdown.OptionData>(); List <WarriorPromotes> l = new List <WarriorPromotes>(); for (int i = 1; i > 1 << 31;) // whoops, bit shifting a signed int will do that, lol { if (GameDataManager.Instance.WarriorPromoteUnlocked((WarriorPromotes)i)) { l.Add((WarriorPromotes)i); } i = i << 1; } for (int i = 0; i < l.Count; i++) { if (i >= ddOpts.Count) { advClasses.Add(AdventurerClass.None); } advClasses[i] = Adventurer._warriorPromoteToAdvClass(l[i]); ddOpts.Add(new Dropdown.OptionData(Adventurer.GetClassName(advClasses[i]))); } dd.AddOptions(ddOpts); }
public void OpenOn(Adventurer _adv) { adv = _adv; shell.Open(); if (_adv.advClass == AdventurerClass.Warrior) { PopulateDropdownForWarrior(); } else if (_adv.advClass == AdventurerClass.Mystic) { PopulateDropdownForMystic(); } else { throw new System.Exception("Opened promote popup on unpromotable unit of class " + adv.advClass.ToString()); } if (dd.options.Count < 2) { dd.interactable = false; } else { dd.interactable = true; } SetClassSelectionBasedOnVal(); }
private string WriteAdventurer(Adventurer adventurer) { string orientation = ""; switch (adventurer.Orientation) { case Orientation.Nord: orientation = "N"; break; case Orientation.Ouest: orientation = "O"; break; case Orientation.Est: orientation = "E"; break; case Orientation.Sud: orientation = "S"; break; default: throw new FormatException(); } return(String.Format("A-{0}-{1}-{2}-{3}-{4}", adventurer.Name, adventurer.Position.X, adventurer.Position.Y, orientation, adventurer.Treasure)); }
public void AddAdventurerTest() { // dumby data var partyName = "Colonize Mars"; var partyToBeUpdated = Parties[partyName]; // new adventurer for adventurers list Adventurer newAdventurer = new Adventurer("Jeff Bezos", new List <string> { "Better Visionary" }); // capturing original data for new party List <Adventurer> existingAdventurers = partyToBeUpdated.Adventurers.ToList(); List <Encounter> existingEncounters = partyToBeUpdated.Encounters.ToList(); PartyState existingPartyState = partyToBeUpdated.State; // adding newAdventurer to original list existingAdventurers.Add(newAdventurer); // (WORK AROUND - Adventurers model is read only) deleting original party Parties.Remove(partyName); // building new party object for party model Party updatedParty = new Party(existingPartyState, existingAdventurers, existingEncounters); // adding to party model Parties.Add(partyName, updatedParty); Assert.IsNotNull(Parties[partyName]); // checking that party name is in partydata (actually added) Assert.IsTrue(Parties.Keys.Contains(partyName)); // checking to make sure there is a total of 2 given one existed Assert.AreEqual(2, Parties[partyName].Adventurers.Count()); }
public void TestPickTreasure() { Adventurer adventurer = new Adventurer(); adventurer.PickTreasure(); Assert.AreEqual(1, adventurer?.CollectedTreasure); }
Adventurer randomizeAdventurer() { Adventurer newPlayer = new Adventurer(); int level = Random.Range(1, 2); int wealth = Random.Range(1, 2); int tier = Random.Range(1, 5); Adventurer.type heroType = Adventurer.type.dps; int hero = Random.Range(0, 3); switch (hero) { case 0: heroType = Adventurer.type.dps; break; case 1: heroType = Adventurer.type.gatherer; break; case 2: heroType = Adventurer.type.healer; break; case 3: heroType = Adventurer.type.tank; break; } newPlayer.SetMeUp(level, wealth, tier, heroType); return(newPlayer); }
public void SetHUD(Adventurer unit) { nameText.text = unit.name; levelText.text = "Lvl " + unit.LvL; hpSlider.maxValue = unit.maxHP; hpSlider.value = unit.currentHP; }
/// <summary> /// Move the adventuerer around the map. This method makes sure the user cannot /// go off of the map. /// </summary> /// <param name="dir">Direction the adventurer is expected to move.</param> /// <returns></returns> public bool MoveAdventurer(Actor.Direction dir) { int maxRow = Cells.GetUpperBound(0); int maxCol = Cells.GetUpperBound(1); Adventurer.Move(dir); // move hero back if he has left the board if (Adventurer.PositionX < 0) { Adventurer.Move(Actor.Direction.Right); } if (Adventurer.PositionX > maxCol) { Adventurer.Move(Actor.Direction.Left); } if (Adventurer.PositionY < 0) { Adventurer.Move(Actor.Direction.Down); } if (Adventurer.PositionY > maxRow) { Adventurer.Move(Actor.Direction.Up); } CurrentLocation.HasBeenSeen = true; return(CurrentLocation.HasItem || CurrentLocation.HasMonster); }
public void initializeTest() { var advent1 = new Adventurer { PosX = 0, PosY = 0, MovementList = "A", Name = "Indiana", FinishMoving = false, PlayerOrientation = "S", Treasures = 0 }; var advent2 = new Adventurer { PosX = 1, PosY = 3, MovementList = "ADDGA", Name = "Shia", FinishMoving = false, PlayerOrientation = "O", Treasures = 0 }; adventurers = new List <IAdventurer> { advent1, advent2 }; var mountain = new Mountain(1, 1) { GotAdventurer = false, tileType = TileType.MOUNTAIN }; var treasure = new Treasure(2, 2, 2) { GotAdventurer = false, tileType = TileType.TREASURE }; map = new Map(5, 5); map.AddMountainToMap(mountain); map.AddTreasureToMap(treasure); map.TileMap[0, 0].GotAdventurer = true; map.TileMap[1, 3].GotAdventurer = true; }
// Update is called once per frame void Update() { if (associatedAdventurer != null && !associatedAdventurer.isPromoted) { if (cachedName != associatedAdventurer.fullName) { cachedName = associatedAdventurer.fullName; inquiryLabel.text = strings[0] + cachedName + strings[1]; } if (cachedClass != associatedAdventurer.baseClass) { cachedClass = associatedAdventurer.baseClass; AdventurerClass advC; if (cachedClass == AdventurerClass.Warrior) { advC = AdventurerClass.Mystic; } else { advC = AdventurerClass.Warrior; } reclassButtonLabel.text = strings[2] + Adventurer.GetClassName(advC); } } }
/// <summary> /// Advance the adventurer /// </summary> /// <param name="treasureMap"></param> /// <param name="adventurer"></param> /// <param name="destY"></param> /// <param name="destX"></param> /// <returns></returns> public static TreasureMap Forward(TreasureMap treasureMap, Adventurer adventurer, int destY, int destX) { if (treasureMap.Map[destY, destX] != BoxeType.Adventurer && treasureMap.Map[destY, destX] != BoxeType.Mountain && treasureMap.Map[destY, destX] != BoxeType.AdventurerTreasure) { if (treasureMap.Map[adventurer.Y, adventurer.X] == BoxeType.AdventurerTreasure) { treasureMap.Map[adventurer.Y, adventurer.X] = BoxeType.Treasure; } else { treasureMap.Map[adventurer.Y, adventurer.X] = BoxeType.Prairie; } if (treasureMap.Map[destY, destX] == BoxeType.Treasure) { var treasure = treasureMap.Treasures.Single(w => w.Y == destY && w.X == destX); if (treasure.Nb > 0) { treasure.Nb--; adventurer.NbTreasure++; treasureMap.Map[destY, destX] = BoxeType.AdventurerTreasure; } } else { treasureMap.Map[destY, destX] = BoxeType.Adventurer; } adventurer.Y = destY; adventurer.X = destX; } return(treasureMap); }
public IHttpActionResult PutAdventurer(int id, Adventurer adventurer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != adventurer.Id) { return(BadRequest()); } db.Entry(adventurer).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AdventurerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
static private void AllAdventurerStop() { foreach (var Adventurer in AdventurerList) { Adventurer.Stop(); } }
static void Main(string[] args) { Adventurer memberA = TrainingCamp.trainAdventurer("archer"); Adventurer memberB = TrainingCamp.trainAdventurer("warrior"); Console.ReadLine(); }
/// <summary> /// Supprimer le dernier mouvement traité de la séquence de mouvements de l'aventurier /// </summary> /// <param name="adventurer">Aventurier</param> public static void RemoveProcessedMove(Adventurer adventurer) { if (!string.IsNullOrEmpty(adventurer?.MovesSequence)) { adventurer.MovesSequence = adventurer?.MovesSequence?.Substring(1); } }
public Adventurer GetAdventurerFromSpecs(bool flag) { Adventurer a = null; try { a = new Adventurer() { Name = AdventurerNameTBox.Text, Level = int.Parse(AdventurerLevelTBox.Text), HealthPoints = double.Parse(AdventurerHPTBox.Text), ManaPoints = double.Parse(AdventurerMPTBox.Text), AttackPoints = double.Parse(AdventurerAPTBox.Text), DefensePoints = double.Parse(AdventurerDPTBox.Text), CreatedOn = DateTime.UtcNow }; if (flag) { a.AdventurerId = int.Parse(IdTBox.Text); } } catch (Exception) { MessageBox.Show("Please Insert Valid Information :("); } return(a); }
/// <summary> /// Sets a UI element containing the info of an Equipment piece /// </summary> /// <param name="adventurer"> Adventurer of which we dispaly an equipment piece </param> /// <param name="equipment"> Piece of equipment to display </param> /// <param name="content"> Location where to display the content </param> /// <returns> the UI element containing the info of an Equipment piece</returns> public void Init(Adventurer adventurer, Equipment equipment, GameObject content) { Debug.Log(prefab == null); Debug.Log(content == null); GameObject newEquipment = (GameObject)Instantiate(prefab, content.transform); Transform partUpper = newEquipment.transform.GetChild(0); Transform partLower = newEquipment.transform.GetChild(1); // Upper Part // Background color partUpper.GetComponent <Image>().color = adventurer.color; // Foreground equipment image partUpper.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("Equipments/Equipment_" + equipment.name); if (partUpper.transform.GetChild(0).GetComponent <Image>().sprite == null) { partUpper.transform.GetChild(0).GetComponent <Image>().sprite = Resources.Load <Sprite>("DEFAULT"); } // Lower Part // Name text partLower.transform.GetChild(0).transform.GetChild(0).GetComponent <TMPro.TextMeshProUGUI>().text = equipment.name; // Description text partLower.transform.GetChild(1).GetComponent <TMPro.TextMeshProUGUI>().text = equipment.description; // Display (or not) the Red cross image newEquipment.transform.GetChild(2).gameObject.SetActive(!equipment.active); }
public void DetailedMember(Adventurer DisplayAdv) { adv = DisplayAdv; switch (adv.tier) { case 0: break; case 1: level.color = new Color32(255, 116, 0, 255); break; case 2: level.color = new Color32(255, 196, 0, 255); break; case 3: level.color = new Color32(237, 255, 0, 255); break; case 4: level.color = new Color32(144, 255, 0, 255); break; case 5: level.color = new Color32(96, 255, 0, 255); break; } wealth.fillAmount = (float)adv.wealth / (float)Player.instance.maxLevel; level.fillAmount = (float)adv.level / (float)Player.instance.maxLevel; upgrade.adventurer = adv; NumberConverter num = new NumberConverter(); dpsText.text = "(" + adv.level + ")" + num.numberConverter(Mathf.Round((float)adv.damage())); priceText.text = num.numberConverter(adv.wealthCost()); }
public void OnTriggerEnter(Collider other) { if (other.tag == "Player") { Player = other.gameObject.GetComponent <Adventurer>(); Player.GetComponent <Movement>().enabled = false; UI.ItemUI.enabled = true; if (weapon != null) { UI.ItemNameLabel.text = weapon.name; UI.ItemDescLabel.text = weapon.description; UI.EquipButton.onClick.AddListener(EquipItem); UI.DiscardButton.onClick.AddListener(DiscardItem); } else if (armor != null) { UI.ItemNameLabel.text = armor.name; UI.ItemDescLabel.text = armor.description; UI.EquipButton.onClick.AddListener(EquipItem); UI.DiscardButton.onClick.AddListener(DiscardItem); } } }
static void Main(string[] args) { if (Console.ReadKey().Key == ConsoleKey.R) { } try { var client = new Client(IPAddress.Parse("127.0.0.1")); var adventure = new Adventurer(); adventure.Name = "Joseph"; adventure.Status = "Biwinning"; adventure.Temperature = 30; adventure.SuitPressure = 3; adventure.OxygenRemaining = TimeSpan.FromDays(2); adventure.HeartRateMode = HeartRateMode.Green; client.Send(0, adventure); } catch (Exception e) { Console.WriteLine("Error..... " + e.StackTrace); } Console.ReadLine(); }
public void StartPrepareCombat() { GameObject go = GameObject.Find("Battle System"); b = go.GetComponent <BattleSystem>(); playerUnit = b.playerUnit; }
/// <summary> /// Effectuer le mouvement d'un aventurier sur la carte /// </summary> /// <param name="adventurer">Aventurier</param> /// <param name="map">Carte aux trésors</param> /// <param name="moveToProcess">Mouvement à traiter</param> public static void ProcessAdventurerMove(Adventurer adventurer, Map map, char moveToProcess) { switch (moveToProcess) { case 'A': if (AdventurerCanMoveForward(adventurer, map)) { adventurer.MoveForward(); Cell currentCell = map?.Cells.FirstOrDefault(c => c.X == adventurer.X && c.Y == adventurer.Y); if (currentCell?.Type == CellType.Treasure) { adventurer.PickTreasure(); currentCell.DecrementTreasure(); } } break; case 'D': adventurer.TurnRight(); break; case 'G': adventurer.TurnLeft(); break; } }
/// <summary> /// an adventurer do a turn /// </summary> /// <param name="iTurn"></param> /// <returns></returns> private async Task AdventurerMakeTurnAsync(int iTurn) { for (int iOrder = 1; iOrder <= CurrentGame.Players.Count; iOrder++) { Adventurer oCurrentAdventurer = CurrentGame.Players[iOrder - 1]; Position oAncientPosition = oCurrentAdventurer.AdventurerPosition; if (oCurrentAdventurer.SequenceMovement.Length >= iTurn) { //find a next position and next orientation (Position oNewPosition, Orientation eNextOrientation) = await _oIDeplacementManage_BLL.GetNextPositionAdventurerAsync(oCurrentAdventurer, iTurn); if (oNewPosition.CompareTo(oAncientPosition) == 0 && await _oIMapManage_BLL.GetValidePositionAsync(CurrentGame.Map, oNewPosition)) { //adventurer can be moved //leave the started case unoccupied CaseMap oAncientCase = CurrentGame.Map.ListeCase.FirstOrDefault(c => oAncientPosition.CompareTo(c.CasePosition) == 1); oAncientCase.IsOccupied = false; //occuper le case d'arrive CaseMap oNewCase = CurrentGame.Map.ListeCase.FirstOrDefault(c => oNewPosition.CompareTo(c.CasePosition) == 1); oNewCase.IsOccupied = true; //changer position du current joueur oCurrentAdventurer.AdventurerPosition = oNewPosition; //recuperer trésor s'il y en a, et décompte le nombre de trésor if (oNewCase.Type == CaseType.Treasure && oNewCase.TreasureNumber > 0) { oCurrentAdventurer.NumberTreasureFound++; oNewCase.TreasureNumber--; } } //set prochaine orientation pour le joueur oCurrentAdventurer.CurrentOrientation = eNextOrientation; } } }
/// <summary> /// Creates a new card based on how many cards have already been made. /// </summary> /// <param name="card"> /// The name of the card to be created. /// </param> /// <returns> /// The new created card. /// </returns> public static Card CreateCard(CardName card) { Contract.Requires(card != CardName.Backside & card != CardName.Empty); Contract.Ensures(Contract.Result<Card>().Name == card); Card c; switch (card) { case CardName.Copper: c = new Copper(); break; case CardName.Silver: c = new Silver(); break; case CardName.Gold: c = new Gold(); break; case CardName.Curse: c = new Curse(); break; case CardName.Estate: c = new Estate(); break; case CardName.Duchy: c = new Duchy(); break; case CardName.Province: c = new Province(); break; case CardName.Gardens: c = new Gardens(); break; case CardName.Cellar: c = new Cellar(); break; case CardName.Chapel: c = new Chapel(); break; case CardName.Chancellor: c = new Chancellor(); break; case CardName.Village: c = new Village(); break; case CardName.Woodcutter: c = new Woodcutter(); break; case CardName.Workshop: c = new Workshop(); break; case CardName.Feast: c = new Feast(); break; case CardName.Moneylender: c = new Moneylender(); break; case CardName.Remodel: c = new Remodel(); break; case CardName.Smithy: c = new Smithy(); break; case CardName.ThroneRoom: c = new ThroneRoom(); break; case CardName.CouncilRoom: c = new CouncilRoom(); break; case CardName.Festival: c = new Festival(); break; case CardName.Laboratory: c = new Laboratory(); break; case CardName.Library: c = new Library(); break; case CardName.Market: c = new Market(); break; case CardName.Mine: c = new Mine(); break; case CardName.Adventurer: c = new Adventurer(); break; case CardName.Bureaucrat: c = new Bureaucrat(); break; case CardName.Militia: c = new Militia(); break; case CardName.Spy: c = new Spy(); break; case CardName.Thief: c = new Thief(); break; case CardName.Witch: c = new Witch(); break; case CardName.Moat: c = new Moat(); break; default: throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated."); } c.Initialize(card, CardsMade[card]); CardsMade[card] += 1; createdCards.Add(c, true); return c; }