public void PassiveEffect_CheckStringIsValid() { String test1 = ""; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test1), "Empty String is invalid"); String test2 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0"; Assert.IsTrue(PassiveEffect.IsValidPassiveEffect(test2), "Basic Active Effect is valid"); String test3 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test3), "Should be at least 3 items in a resource"); String test4 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":10:11"; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test4), "Should be at most 3 items in a resource"); String test5 = PassiveEffect.TAG + ":blah:10"; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test5), "Should affect one of the 4 primary character resources"); String test6 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + PlayerCharacter.HEALTH; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test6), "Third item should be an int"); String test7 = "AE:" + PlayerCharacter.HEALTH + ":100"; Assert.IsFalse(PassiveEffect.IsValidPassiveEffect(test7), "First item should be PE"); }
public void PassiveEffect_ParseFromString() { PassiveEffect pe = new PassiveEffect(PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.8"); Assert.AreEqual(0.8f, pe.GetModifier(), "The value should be 0.8"); Assert.AreEqual(PlayerCharacter.HEALTH, pe.GetResourceName(), "The string should match " + PlayerCharacter.HEALTH); }
public void PassiveEffect_ParseToString() { String expected = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.7"; PassiveEffect pe = new PassiveEffect(expected); Assert.AreEqual(expected, pe.ParseToString(), "String should be " + expected); }
public MenuItem(PassiveEffect effect, string name, string effectDesc, string desc, int value) { this.effect = effect; this.name = name; this.effectDesc = effectDesc; this.desc = desc; this.value = value; }
public CommentaryMessageSettings (string aMessage,ECommentaryMessageType aType,ECommentaryMessagePosition aMessagePosition,PassiveEffect aEffect,BattleMonster aMonster) { message = aMessage; type = aType; position = aMessagePosition; passiveEffect = aEffect; monster = aMonster; }
public void PassiveEffect_StandardConstructor() { float mod = 0.8f; String res = PlayerCharacter.HEALTH; PassiveEffect pe = new PassiveEffect(res, mod); Assert.AreEqual(res, pe.GetResourceName(), "Resource should be " + res); Assert.AreEqual(mod, pe.GetModifier(), "Modifier should match" + mod); }
public EquipmentDescription(string nom) { InitializeComponent(); CenterToParent(); // ---- TMR if (nom.Equals("Storm Kickers")) { Equipment S_K = Equipment.CreateEquipment("Storm Kickers", "A pair of sneackers said to have belonged to a warrior of legend. On the right set of feet these stylish shoes are capable of granting its wearer the power to withstand lightning." , "Icon-Storm_Kickers", EquipmentType.Accessory, "TMR Esther"); S_K.AddFixedStat(StatBuffed.ATK, 45); S_K.AddFixedStat(StatBuffed.DEF, 10); PassiveEffect S_K1_1 = PassiveEffect.CreateStatistiquesBuffEffect(StatistiquesBuff.HP, 20); PassiveEffect S_K1_2 = PassiveEffect.CreateLBDamageEffect(15); UnitPassive S_K1 = new UnitPassive(0, 0, "Icon-Ability_276", "Inner Limit"); S_K1.AddPassiveEffect(S_K1_1); S_K1.AddPassiveEffect(S_K1_2); S_K.AddEquipmentEffectPassive(S_K1); PassiveEffect S_K2_1 = PassiveEffect.CreateAbsorbDamageEffect(ElementDamage.Lightning, TypeDamage.Hybrid); UnitPassive S_K2 = new UnitPassive(0, 0, "Icon-Ability_280", "Stormborne"); S_K2.UsableWitheList = true; S_K2.AddUnitToWhiteList("Esther"); S_K2.AddPassiveEffect(S_K2_1); S_K.AddEquipmentEffectPassive(S_K2); equipment = S_K; } else // ---- STMR { Equipment SBJ = Equipment.CreateEquipment("Storm Bunny Jacket", "A unique jacket with a hood that ressembles rabbit ears. It fills its wearer with the instincts of a swift killer, and adds to their endurance and strength as well. Woven with the finest fabric of a distant world, it was exclusively made for a certain warrior of legend.", "Icon-Storm_Bunny_Jacket", EquipmentType.Clothe, "STM Esther"); SBJ.AddFixedStat(StatBuffed.HP, 800); SBJ.AddFixedStat(StatBuffed.ATK, 40); SBJ.AddFixedStat(StatBuffed.DEF, 10); PassiveEffect SBJ1_1 = PassiveEffect.CreateMonsterRaceBuffEffect(MonsterRace.Machinas | MonsterRace.Stones, TypeDamage.Hybrid, 50); UnitPassive SBJ1 = new UnitPassive(0, 0, "Icon-Ability_275", "Killer Instincts"); SBJ1.AddPassiveEffect(SBJ1_1); SBJ.AddEquipmentEffectPassive(SBJ1); PassiveEffect SBJ2_1 = PassiveEffect.CreateStatistiquesBuffEffect(StatistiquesBuff.HP, 20); PassiveEffect SBJ2_2 = PassiveEffect.CreateStatistiquesBuffEffect(StatistiquesBuff.ATK, 30); UnitPassive SBJ2 = new UnitPassive(0, 0, "Icon-Ability_276", "Exquisite Weaving"); SBJ2.UsableWitheList = true; SBJ2.AddUnitToWhiteList("Esther"); SBJ2.AddPassiveEffect(SBJ2_1); SBJ2.AddPassiveEffect(SBJ2_2); SBJ.AddEquipmentEffectPassive(SBJ2); equipment = SBJ; } InitializeUpPanel(); InitializeStatsTab(); InitializePassiveTab(); Text = equipment.Name; }
public void PassiveEffect_SamePassive() { String passive1 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.7"; String passive2 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.8"; String passive3 = PassiveEffect.TAG + ":" + PlayerCharacter.SANITY + ":0.7"; PassiveEffect pe1 = new PassiveEffect(passive1); PassiveEffect pe2 = new PassiveEffect(passive2); PassiveEffect pe3 = new PassiveEffect(passive3); Assert.IsTrue(pe1.SamePassiveType(pe1), "Passive Effect type should match itself"); Assert.IsTrue(pe1.SamePassiveType(pe2), "Passive Effect type should match another of the same type"); Assert.IsFalse(pe1.SamePassiveType(pe3), "Passive Effect type should not match another type"); }
public void PassiveEffect_MergePassive() { String passive1 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.7"; String passive2 = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":0.8"; String passive3 = PassiveEffect.TAG + ":" + PlayerCharacter.SANITY + ":0.7"; PassiveEffect pe1 = new PassiveEffect(passive1); PassiveEffect pe2 = new PassiveEffect(passive2); PassiveEffect pe3 = new PassiveEffect(passive3); var merged1 = pe1.MergeEffect(pe2); var merged2 = pe1.MergeEffect(pe3); Assert.AreEqual(0.7 * 0.8, merged1.GetModifier(), 0.001, "After the merge modifier should be " + 0.7 * 0.8); Assert.AreEqual(pe1, merged2, "Different type merged should leave orginal the same"); }
private void button1_Click(object sender, EventArgs e) { currentItem = new Item(); int id; if (int.TryParse(itemIDTextBox.Text, out id)) { currentItem.itemID = id; currentItem.name = nameBox.Text; currentItem.description = descriptionTextBox.Text; HashSet <int> reqs = new HashSet <int>(); List <ActiveEffect> aeList = new List <ActiveEffect>(); List <PassiveEffect> peList = new List <PassiveEffect>(); foreach (int req in requirementsList) { reqs.Add(req); } currentItem.requirements = reqs; foreach (String ae in itemActiveList) { ActiveEffect temp = new ActiveEffect(ae); aeList.Add(temp); } currentItem.activeEffects = aeList; foreach (String pe in itemPassiveList) { PassiveEffect temp = new PassiveEffect(pe); peList.Add(temp); } currentItem.passiveEffects = peList; currentItem.iconFileName = iconSelect.SelectedValue.ToString(); String output = currentItem.ParseToString(); if (Item.IsValidItem(output)) { itemStringTextBox.Text = output; itemList.Add(currentItem.itemID, currentItem); } else { MessageBox.Show(this, output); } } }
public void PC_UpdateModifiers() { PlayerCharacter pc = new PlayerCharacter(); PassiveEffect healthMod = new PassiveEffect(PlayerCharacter.HEALTH, 1.2f); List <PassiveEffect> list = new List <PassiveEffect>(); list.Add(healthMod); pc.UpdateModifers(list); String expected = PlayerCharacter.HEALTH + ":100:1.2," + PlayerCharacter.HUNGER + ":100:1," + PlayerCharacter.THIRST + ":100:1," + PlayerCharacter.SANITY + ":100:1"; String result = pc.ParseToString(); Assert.AreEqual(expected, result, "Health modifier should be 1.2"); }
public void PC_AdjustmentMinimumIsOne() { PlayerCharacter pc = new PlayerCharacter(); PassiveEffect healthMod = new PassiveEffect(PlayerCharacter.HEALTH, 0.1f); List <PassiveEffect> list = new List <PassiveEffect>(); list.Add(healthMod); pc.UpdateModifers(list); pc.AdjustResource(PlayerCharacter.HEALTH, -1); int expected = 100 - 1; int result = pc.GetResource(PlayerCharacter.HEALTH); Assert.AreEqual(expected, result, "Health should be 99"); }
public void PC_ModifierApplied() { PlayerCharacter pc = new PlayerCharacter(); PassiveEffect healthMod = new PassiveEffect(PlayerCharacter.HEALTH, 0.8f); List <PassiveEffect> list = new List <PassiveEffect>(); list.Add(healthMod); pc.UpdateModifers(list); pc.AdjustResource(PlayerCharacter.HEALTH, -20); int expected = 100 - Convert.ToInt32(20 * 0.8); int result = pc.GetResource(PlayerCharacter.HEALTH); Assert.AreEqual(expected, result, "Health should be 84"); }
public void ConvertToXml_MapsCorrectly() { //Arrange var passiveEffectMapper = new PassiveEffectMapper(); var domainSource = new PassiveEffect("name") { MatchAllTags = "true", Operation = "operation", Tags = "tags", Value = "value" }; //Act var xml = passiveEffectMapper.Convert(domainSource); //Assert Assert.IsInstanceOfType(xml, typeof(entity_classesEntity_classEffect_groupPassive_effect)); Assert.AreEqual("name", xml.name); Assert.AreEqual("true", xml.match_all_tags); Assert.AreEqual("operation", xml.operation); Assert.AreEqual("tags", xml.tags); Assert.AreEqual("value", xml.value); }
private void createPassive_Click(object sender, EventArgs e) { double amount; if (double.TryParse(passiveAmount.Text, out amount)) { String resource = passiveResource.SelectedValue.ToString(); String result = String.Format("{0}:{1}:{2}", PassiveEffect.TAG, resource, amount); if (PassiveEffect.IsValidPassiveEffect(result)) { passiveEffectsList.Add(result); } } string toWrite = "PASSIVEEFFECTS"; foreach (String ie in passiveEffectsList) { toWrite += "^" + ie; } WriteFile("passiveEffects.txt", toWrite); }
// TODO Apply HP Boosts to team? public bool applyHPBoostsToTeam(PassiveEffect aEffect,BattleMonster aActioningMonster,MoveQueueItem aMoveQueueItem,ETeamPosition aTeamPosition) { if(containsMonster(aActioningMonster)) { ESplashRange splash = aEffect.moveRef.splashRange; float splashPercent = aEffect.moveRef.splashPercent; if(aEffect.applyAt==EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue&&((aMoveQueueItem.moveData.elementType==aEffect.whenMoveElementType)||(aEffect.whenMoveElementType==null))) { EMonsterPos target = positionForMonster(aActioningMonster); BetterList<BattleMonster> targets = getBoostTargetsForMove(target,aEffect.moveRef,aActioningMonster); if(targets.size>0) { for(int i =0;i<targets.size;i++) { if(i==0) targets[i].applyHPBoostForMove(aEffect.moveRef,1.0f,aTeamPosition,positionForMonster(targets[i])); else { targets[i].applyHPBoostForMove(aEffect.moveRef,splashPercent,aTeamPosition,positionForMonster(targets[i])); } } } else { } } } else { } return false; }
public void Item_CheckFullStringIsValid() { String expected = "ID:1,Name:TestItem,Amount:1,Description:test item 1," + "ActiveEffect:" + ActiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10" + ":" + ActiveEffect.TAG + ":" + PlayerCharacter.THIRST + ":" + "10" + ",PassiveEffect:" + PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "0.8" + ":" + PassiveEffect.TAG + ":" + PlayerCharacter.SANITY + ":" + "0.9" + ":" + PassiveEffect.TAG + ":" + PlayerCharacter.HUNGER + ":" + "0.8" + ",Requirements:2,Icon:test.png"; Assert.IsTrue(Item.IsValidItem(expected), "Full String should be valid"); String test1 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect:,PassiveEffect,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test1), "If active effect has items it should have at least 1"); String test2 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect:a,PassiveEffect,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test2), "If active effect has items they should be in groups of 3"); String test3 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect:a:b,PassiveEffect,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test3), "If active effect has items they should be in groups of 3"); String test4 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect:a:b:c:d,PassiveEffect,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test4), "If active effect has items they should be in groups of 3"); String test5a = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect:" + PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10,PassiveEffect,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test5a), "Active Effect should be valid"); String test5b = PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10"; Assert.AreEqual(Item.IsValidItem(test5a), ActiveEffect.IsValidActiveEffect(test5b), "Invalid Active Effect should mean invalid Item"); String test6 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect:,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test6), "If passive effect has items it should have at least 1"); String test7 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect:a,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test7), "If passive effect has items they should be in groups of 3"); String test8 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect:a:b,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test8), "If passive effect has items they should be in groups of 3"); String test9 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect:a:b:c:d,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test9), "If passive effect has items they should be in groups of 3"); String test10a = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect:" + ActiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10,Requirements,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test10a), "Passive Effect should be valid"); String test10b = ActiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10"; Assert.AreEqual(Item.IsValidItem(test10a), PassiveEffect.IsValidPassiveEffect(test10b), "Invalid Passive Effect should mean invalid Item"); String test11 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements:,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test11), "If Requirements has items it should have at least 1"); String test12 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements:asdasd,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test12), "If Requirements has items they should be ints"); String test13 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements:2:3:2,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test13), "If Requirements has items there shouldn't be duplicates"); String test14 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements:2:3::4,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test14), "If Requirements has items none should be null"); String test15 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements:2:-3:3:4,Icon:test.png"; Assert.IsFalse(Item.IsValidItem(test15), "If Requirements has items none should be negative"); }
public void Inventory_TotalPassives() { String itemStr1 = "ID:1,Name:TestItem,Amount:1,Description:test item 1,ActiveEffect,PassiveEffect,Requirements"; String itemStr2 = "ID:2,Name:TestItem,Amount:1,Description:test item 2," + "ActiveEffect:" + ActiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10" + ":" + ActiveEffect.TAG + ":" + PlayerCharacter.THIRST + ":" + "10" + ",PassiveEffect:" + PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "0.8" + ",Requirements:2"; String itemStr3 = "ID:3,Name:TestItem,Amount:2,Description:test item 3," + "ActiveEffect:" + ActiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "10" + ":" + ActiveEffect.TAG + ":" + PlayerCharacter.THIRST + ":" + "10" + ",PassiveEffect:" + PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "0.8" + ":" + PassiveEffect.TAG + ":" + PlayerCharacter.SANITY + ":" + "0.9" + ":" + PassiveEffect.TAG + ":" + PlayerCharacter.HUNGER + ":" + "0.8" + ":" + PassiveEffect.TAG + ":" + PlayerCharacter.THIRST + ":" + "0.8" + ",Requirements:2"; var emptyInv = new Inventory(); var noPassives = new Inventory(Inventory.TAG + "#" + itemStr1); var singlePassive = new Inventory(Inventory.TAG + "#" + itemStr1 + "#" + itemStr2); var multiplePassives = new Inventory(Inventory.TAG + "#" + itemStr1 + "#" + itemStr2 + "#" + itemStr3); var calculatedPassives = new List <PassiveEffect>(); calculatedPassives = emptyInv.GetAllPassives(); Assert.AreEqual(0, calculatedPassives.Count, "Should be no pasives in an empty inventory"); calculatedPassives = noPassives.GetAllPassives(); Assert.AreEqual(0, calculatedPassives.Count, "Should be no pasives in an inventory with no passives"); calculatedPassives = singlePassive.GetAllPassives(); var single = calculatedPassives[0]; var singleTest = new PassiveEffect(PassiveEffect.TAG + ":" + PlayerCharacter.HEALTH + ":" + "0.8"); Assert.AreEqual(1, calculatedPassives.Count, "Should only be a single passive"); Assert.AreEqual(0.8, single.GetModifier(), 0.001, "modifier should be 0.8"); Assert.AreEqual(singleTest.ParseToString(), single.ParseToString(), "PassiveEffects should match"); calculatedPassives = multiplePassives.GetAllPassives(); Assert.AreEqual(4, calculatedPassives.Count, "Should be exactly 4 passives"); foreach (PassiveEffect calc in calculatedPassives) { switch (calc.GetResourceName()) { case PlayerCharacter.HEALTH: Assert.AreEqual(0.8 * 0.8, calc.GetModifier(), 0.001, "Health modifier should be merged"); break; case PlayerCharacter.HUNGER: Assert.AreEqual(0.8, calc.GetModifier(), 0.001, "Hunger modifier should be 0.8"); break; case PlayerCharacter.SANITY: Assert.AreEqual(0.9, calc.GetModifier(), 0.001, "Sanity modifier should be 0.9"); break; case PlayerCharacter.THIRST: Assert.AreEqual(0.8, calc.GetModifier(), 0.001, "Thirst modifier should be 0.8"); break; } } }
public TalentEffect() { Effect = new PassiveEffect(); Description = ""; }
/// <summary> /// Adds a passive effect to the player's stats /// </summary> /// <param name="pe">A valid PassiveEffect</param> public void AddPassiveEffect(PassiveEffect pe) { stats.AddEffect(pe); }
/// <summary> /// Removes a specified effect from passiveEffects /// </summary> /// <param name="pe">A valid PassiveEffect</param> public void RemoveEffect(PassiveEffect pe) { passiveEffects.Remove(pe); }
/// <summary> /// Generates 0-4 rooms off of a given room /// </summary> /// <param name="stemRoom">The room to generate more rooms off of</param> /// <param name="size">The maximum size of the floor</param> /// <param name="xPos">X-value of the stem room on the roomSwitch array</param> /// <param name="yPos">Y-value of the stem room on the roomSwitch array</param> /// <param name="chance">Chance of trying to generate a room off of the stem room, out of 100</param> private void GenerateRoom(Room stemRoom, int size, int xPos, int yPos, int chance) { //Allows the program to know whether or not it can generate a room without overlapping with another one bool canGenerate; //Only tries to generate if the chance is high enough if (chance > 40) { //Generates for each side of the stem room for (int direction = UP; direction < ROOM_SIDES; direction++) { //Begins with the assumption that a new room can be generated canGenerate = true; //Chance of trying is dependent on the given "chance" value if (rng.Next(0, 101) <= chance) { //Sets canGenerate to TRUE if generating new room will not leave the bounds set by size //Otherwise sets canGenerate to FALSE switch (direction) { case UP: canGenerate = (yPos > 0); break; case DOWN: canGenerate = (yPos + 1 < size); break; case LEFT: canGenerate = (xPos > 0); break; case RIGHT: canGenerate = (xPos + 1 < size); break; } //Only checks if it is still possible to generate a room if (canGenerate == true) { //Keeps canGenerate set to TRUE if the position in roomSwitch corresponding to a new room is set to FREE //Otherwise sets canGenerate to FALSE switch (direction) { case UP: canGenerate = roomSwitch[xPos, yPos - 1]; break; case DOWN: canGenerate = roomSwitch[xPos, yPos + 1]; break; case LEFT: canGenerate = roomSwitch[xPos - 1, yPos]; break; case RIGHT: canGenerate = roomSwitch[xPos + 1, yPos]; break; } } //Only generates new room if both restrictions set above have been met if (canGenerate == true) { //Generates new room Room newRoom = new Room(content, rng.Next(1, ROOM_TYPES + 1)); //Sets new room to be connected to the stem room stemRoom.SetConnectedRoom(direction, newRoom); //Sets stem room to be connected to the new room if (direction > 1) { newRoom.SetConnectedRoom(direction - 2, stemRoom); } else { newRoom.SetConnectedRoom(direction + 2, stemRoom); } //Incriments xPos or yPos depending on the direction that the new room was generated in switch (direction) { case UP: //Marks the new room's corresponding position in roomSwitch to TAKEN, so no rooms overlap it roomSwitch[xPos, yPos - 1] = TAKEN; //Generates the room this.GenerateRoom(newRoom, size, xPos, yPos - 1, chance - 2); break; case DOWN: //Marks the new room's corresponding position in roomSwitch to TAKEN, so no rooms overlap it roomSwitch[xPos, yPos + 1] = TAKEN; //Generates the room this.GenerateRoom(newRoom, size, xPos, yPos + 1, chance - 2); break; case LEFT: //Marks the new room's corresponding position in roomSwitch to TAKEN, so no rooms overlap it roomSwitch[xPos - 1, yPos] = TAKEN; //Generates the room this.GenerateRoom(newRoom, size, xPos - 1, yPos, chance - 2); break; case RIGHT: //Marks the new room's corresponding position in roomSwitch to TAKEN, so no rooms overlap it roomSwitch[xPos + 1, yPos] = TAKEN; //Generates the room this.GenerateRoom(newRoom, size, xPos + 1, yPos, chance - 2); break; } } } } } //Turns the stem room into an item room else { //Clears all obstacles in the room stemRoom.GetObstacles().Clear(); //Picking an item PassiveEffect item = availableItems[rng.Next(0, availableItems.Count)]; //Takes the chosen item out of the item pool availableItems.Remove(item); closedItems.Add(item); //Places the item pedestal stemRoom.AddItemPedestal(item); //Refreshes the pool in the case that it gets drained of items if (availableItems.Count == 0) { while (closedItems.Count > 0) { availableItems.Add(closedItems[0]); closedItems.RemoveAt(0); } } } //Builds walls around room stemRoom.BuildWalls(); }
/// <summary> /// Adds an Item Pedestal to the room /// </summary> /// <param name="item">A valid PassiveEffect</param> public void AddItemPedestal(PassiveEffect item) { items.Add(new ItemPedestal(item)); }
public float applyStatEffectsFromMove(MoveLibItem aItem,MoveQueueItem aMoveQueue,PassiveEffect aEffect) { return applyStatEffectsFromMove(aItem,aMoveQueue); }
/// <summary> /// Draws a specified item in a specified Rectangle /// </summary> /// <param name="sb">A valid Spritebatch (Must have already called Begin method)</param> /// <param name="drawRec">A valid Rectangle</param> /// <param name="effect">A valid PassiveEffect</param> private void DrawItem(SpriteBatch sb, Rectangle drawRec, PassiveEffect effect) { //Draws a texture, chosen based on the given PassiveEffect switch (effect) { case PassiveEffect.Damage_FocusLens: sb.Draw(lensTexture, drawRec, Color.White); break; case PassiveEffect.Damage_Graphene: sb.Draw(grapheneTexture, drawRec, Color.White); break; case PassiveEffect.Damage_Nanomaterial: sb.Draw(nanoTexture, drawRec, Color.White); break; case PassiveEffect.Damage_SapphireCrystal: sb.Draw(crystalTexture, drawRec, Color.White); break; case PassiveEffect.FireRate_Overclocked: sb.Draw(overclockedTexture, drawRec, Color.White); break; case PassiveEffect.FireRate_RoboOnion: sb.Draw(onionTexture, drawRec, Color.White); break; case PassiveEffect.FireRate_TitanX: sb.Draw(titanXTexture, drawRec, Color.White); break; case PassiveEffect.Health_Chess: sb.Draw(chessTexture, drawRec, Color.White); break; case PassiveEffect.Health_FaradayArmour: sb.Draw(faradayTexture, drawRec, Color.White); break; case PassiveEffect.Health_LiIonBattery: sb.Draw(batteryTexture, drawRec, Color.White); break; case PassiveEffect.Health_NuclearPower: sb.Draw(nuclearTexture, drawRec, Color.White); break; case PassiveEffect.Homing_HAL: sb.Draw(skynetTexture, drawRec, Color.White); break; case PassiveEffect.QuadShot_QuadCore: sb.Draw(quadCoreTexture, drawRec, Color.White); break; case PassiveEffect.Range_SilphScope: sb.Draw(scopeTexture, drawRec, Color.White); break; case PassiveEffect.Speed_AluminumArmour: sb.Draw(aluminumTexture, drawRec, Color.White); break; case PassiveEffect.Speed_LiquidCooling: sb.Draw(coolingTexture, drawRec, Color.White); break; } }
public float applyStatusEffectsForMove(MoveLibItem aMove,float aSplashPercent,PassiveEffect aEffect) { return applyStatusEffectsForMove(aMove,aSplashPercent); }
public float applyPassiveEffectToMonsters(EWhenToApply aWhen,PassiveEffect aEffect,BattleMonster aPassiveEffectOwner,EMonsterPos aEffectOwnerPosition,MoveQueueItem aMoveQueueItem) { float delayAmount = 0f; if(aEffect.applyAt==aWhen) { if(this.containsMonster(aPassiveEffectOwner)) { // Check Splash on this passive effect BetterList<BattleMonster> monsters = new BetterList<BattleMonster>(); if(aMoveQueueItem!=null) monsters = this.getBoostTargetsForMove(positionForMonster(aPassiveEffectOwner),aEffect.moveRef,(BattleMonster) aMoveQueueItem.actioningMonster); else monsters = this.getBoostTargetsForMove(positionForMonster(aPassiveEffectOwner),aEffect.moveRef,aPassiveEffectOwner); if(aEffect.moveRef==null) { Debug.LogError("Passive effect for: "+aPassiveEffectOwner.name+" is "+aEffect.moveRef+" passive effect is: "+aPassiveEffectOwner.monster.passiveEffect.name); return 0f; } if(aEffect.moveRef.elementType!=ElementalLibrary.REF.getElement("Normal")) { // This passive effect can only be applied to monsters of type: aEffect.moveRef.elementType for(int i = 0;i<monsters.size;i++) { if(monsters[i].monster.elementType!=aEffect.moveRef.elementType) { monsters.RemoveAt(i); i--; } } for(int i = 0;i<monsters.size;i++) { monsters[i].applyStatEffectsFromMove(aEffect.moveRef,null,aEffect); delayAmount += monsters[i].applyStatusEffectsForMove(aEffect.moveRef,1,aEffect); this.applyHPBoostsToTeam(aEffect,aPassiveEffectOwner,aMoveQueueItem,this._position); if(aEffect.moveRef.decisiveBlowsImmunity>0f) { monsters[i].criticalHitImmune = true; } if(aEffect.moveRef.oneHitKillInvulnerable>0f) { monsters[i].oneHitKOImmune = true; } } } } else { BetterList<BattleMonster> monsters = this.getTargetsForMove(EMonsterPos.Unset,aEffect.moveRef); for(int i = 0;i<monsters.size;i++) { monsters[i].applyStatEffectsFromMove(aEffect.moveRef,null,aEffect); delayAmount += monsters[i].applyStatusEffectsForMove(aEffect.moveRef,1,aEffect); applyHPEffectToTeam(aEffect,aPassiveEffectOwner,aEffectOwnerPosition); } } } return delayAmount; }
// From passive effect public void applyHPEffectToTeam(PassiveEffect aEffect,BattleMonster aMonster,EMonsterPos aPositions) { if(containsMonster(aMonster)) { Debug.Log("NO HP Effect to apply"); } else { ESplashRange splash = aEffect.moveRef.splashRange; float splashPrecent = aEffect.moveRef.splashPercent; EMonsterPos target = EMonsterPos.Unset; BetterList<BattleMonster> targets = getTargetsForMove(target,aEffect.moveRef); for(byte c = 0;c<targets.size;c++) { if(c == 0) { applyHPEffectToMonster(aMonster,aEffect.moveRef,1.0f,targets[c],null,aPositions); } else { applyHPEffectToMonster(aMonster,aEffect.moveRef,splashPrecent,targets[c],null,aPositions); } } } }
virtual public void LevelUp() { Level += Level == MaxLevel ? 0 : 1; PassiveEffect?.LevelUp(); }
/// <summary> /// Sets the item which this pedestal holds /// </summary> /// <param name="newItem">A valid PassiveEffect</param> public void SetItem(PassiveEffect newItem) { item = newItem; }
/// <summary> /// Adds a passive effect to the stats /// </summary> /// <param name="pe">A valid PassiveEffect</param> public void AddEffect(PassiveEffect pe) { passiveEffects.Add(pe); }
/// <summary> /// Adds an effect to the inventory /// </summary> /// <param name="pe">A valid PassiveEffect</param> protected void AddItem(PassiveEffect pe) { switch (pe) { case PassiveEffect.Damage_FocusLens: items.Add(new MenuItem(pe, "Focus Lens", "Damage Up", "Your focus needs more focus.", 30)); break; case PassiveEffect.Damage_Graphene: items.Add(new MenuItem(pe, "Graphene", "Damage Up", "Highly conductive!", 50)); break; case PassiveEffect.Damage_Nanomaterial: items.Add(new MenuItem(pe, "Nanomaterial", "Damage Up", "Let's get nanoscopic.", 10)); break; case PassiveEffect.Damage_SapphireCrystal: items.Add(new MenuItem(pe, "Sapphire Crystal", "Damage Up", "It's blue. (A ba dee a ba die)", 15)); break; case PassiveEffect.FireRate_Overclocked: items.Add(new MenuItem(pe, "Overclocked!", "Fire Rate Up", "If only you installed liquid cooling...", 165)); break; case PassiveEffect.FireRate_RoboOnion: items.Add(new MenuItem(pe, "Robo-Onion", "Fire Rate Up, Damage Down", "Robots cry lasers, apparently.", 15)); break; case PassiveEffect.FireRate_TitanX: items.Add(new MenuItem(pe, "Titan X", "Fire Rate Up", "You're no peasant.", 50)); break; case PassiveEffect.Health_Chess: items.Add(new MenuItem(pe, "Chess", "Health Up", "How about a nice game of chess?", 10)); break; case PassiveEffect.Health_FaradayArmour: items.Add(new MenuItem(pe, "Faraday Armour", "Health Up", "Like chainmail! For robots!", 10)); break; case PassiveEffect.Health_LiIonBattery: items.Add(new MenuItem(pe, "Li-Ion Battery", "Health Up", "It just goes on and on and on...", 10)); break; case PassiveEffect.Health_NuclearPower: items.Add(new MenuItem(pe, "Nuclear Power", "Health Up", "Clean! (ish)", 10)); break; case PassiveEffect.Homing_HAL: items.Add(new MenuItem(pe, "HAL", "Homing Lasers!", "I can't let you do that, Lane...", 40)); break; case PassiveEffect.QuadShot_QuadCore: items.Add(new MenuItem(pe, "Quad Core", "Quad Shot! Fire Rate Down...", "Dodge this!", 45)); break; case PassiveEffect.Range_SilphScope: items.Add(new MenuItem(pe, "Silph Scope", "Range Up", "Gotta see 'em all!", 30)); break; case PassiveEffect.Speed_AluminumArmour: items.Add(new MenuItem(pe, "Aluminum Armour", "Speed Up", "Lighter casing.", 20)); break; case PassiveEffect.Speed_LiquidCooling: items.Add(new MenuItem(pe, "Liquid Cooling", "Speed Up", "If only you were overclocked...", 165)); break; } }
public ItemPedestal(PassiveEffect item) { hitbox = new Circle(new Vector2(ROOM_WIDTH / 2 - PEDESTAL_SIZE / 2, ROOM_HEIGHT / 2 - PEDESTAL_SIZE / 2), PEDESTAL_SIZE); this.item = item; }