private void SetDefaultParams() { Skills = new Skills(); // set all skills to 1 IsDead = false; // not death (why would it be death during the start??) IsInCombat = false; // not in combat CurrentCombatStyle = CombatStyle.Melee; // default melee }
public SaveGame(int saveNumber, string name, int level, CombatStyle combatStyle, PlayableZone currentZone) { SaveNumber = saveNumber; Name = name; Level = level; CombatStyle = combatStyle; Zone = currentZone; }
public Armor(int id, string name, int requiredLevel, int value, int additionalHealth, CombatStyle combatStyle, params ArmorCategory[] armorCategories) { _id = id; _name = name; Value = value; RequiredLevel = requiredLevel; BonusHealth = additionalHealth; CombatStyle = combatStyle; ArmorCategories = armorCategories; }
public static float CombatTriggerRange(CombatStyle combatStyle) { switch (combatStyle) { case CombatStyle.Defensive: return(2); case CombatStyle.InBetween: return(5); case CombatStyle.Offensive: return(7); default: return(5); } }
public void ChoosesAFeatFromTheAvailableFeats() { var yaml = @" - name: Archery bonus-feats: - level: 1 feats: [feat one]".ParseYaml().Children.First(); var combatStyle = new CombatStyle(yaml); var character = CharacterTestTemplates.Ranger(); character.SetLevel(2); character.Add(combatStyle); var step = new SelectCombatStyleFeat(); step.ExecuteStep(character); AssertCharacter.HasFeatToken("feat one", character); }
private void SwitchCombatStyle() { if (currentStyle.Equals(CombatStyle.TELEKINESIS)) { currentStyle = CombatStyle.MELEE; arm.ResetPosition(); arm.GetComponent <Collider2D>().enabled = false; GameObject.Find("DragPoint").GetComponent <Drag>().enabled = false; animator.Play("DrawSword"); drawingSword = true; } else if (currentStyle.Equals(CombatStyle.MELEE)) { arm.ResetPosition(); arm.GetComponent <Collider2D>().enabled = true; animator.Play("SheatheSword"); sheatingSword = true; } }
public void DeserializeSomeYamlToLoadTheAbility() { var yaml = @" - name: Archery bonus-feats: - level: 1 feats: [feat one, feat two] - level: 6 feats: [feat three, feat four]".ParseYaml().Children.First(); // TODO: The above is cumbersome for tests where I want to test // just some basic configuration var combatStyle = new CombatStyle(yaml); Assert.Equal(combatStyle.DisplayString(), "Combat Style (Archery)"); var level1feats = combatStyle.GetFeats(1); Assert.NotStrictEqual(level1feats, new string[] { "feat one", "feat two" }); var level6feats = combatStyle.GetFeats(6); Assert.NotStrictEqual(level6feats, new string[] { "feat one", "feat two", "feat three", "feat four" }); }
public void setStyle(CombatStyle style) { this.style = style; }
public void setDefault() { this.skill = CombatSkill.ACCURATE; this.style = CombatStyle.CRUSH; this.slot = 0; }
public void HandleSwitchToMeleeCombatMode(CombatMode olCombatMode) { // TODO and FIXME: GetInventoryItem doesn't work for this so this function is effectively broke bool shieldEquiped = false; bool weaponInShieldSlot = false; // Check to see if we were in missile combat and have an arrow hanging around we might need to remove. HandleUnloadMissileAmmo(olCombatMode); HeldItem mEquipedShieldSlot = Children.Find(s => s.EquipMask == EquipMask.Shield); if (mEquipedShieldSlot != null) { //WorldObject itemInShieldSlot = GetInventoryItem(new ObjectGuid(mEquipedShieldSlot.Guid)); var itemInShieldSlot = GetEquippedShield(); if (itemInShieldSlot != null) { if (itemInShieldSlot.ItemType == ItemType.Armor) { shieldEquiped = true; } else { weaponInShieldSlot = true; } } } HeldItem mEquipedMelee = Children.Find(s => s.EquipMask == EquipMask.MeleeWeapon); HeldItem mEquipedTwoHanded = Children.Find(s => s.EquipMask == EquipMask.TwoHanded); MotionStance ms = MotionStance.Invalid; CombatStyle cs = CombatStyle.Undef; // are we unarmed? If so, do we have a shield? if (mEquipedMelee == null && mEquipedTwoHanded == null && !weaponInShieldSlot) { if (!shieldEquiped) { ms = MotionStance.UaNoShieldAttack; } else { ms = MotionStance.MeleeShieldAttack; } } else if (weaponInShieldSlot) { ms = MotionStance.DualWieldAttack; } if (mEquipedTwoHanded != null) { WorldObject twoHandedWeapon = GetInventoryItem(new ObjectGuid(mEquipedTwoHanded.Guid)); if (twoHandedWeapon.DefaultCombatStyle != null) { cs = twoHandedWeapon.DefaultCombatStyle.Value; // ms = MotionStance.TwoHandedSwordAttack; // ms = MotionStance.TwoHandedStaffAttack; ? switch (cs) { // case CombatStyle.??? // ms = MotionStance.TwoHandedStaffAttack; // break; default: ms = MotionStance.TwoHandedSwordAttack; break; } } } // Let's see if we are melee single handed / two handed with our without shield as appropriate. if (mEquipedMelee?.Guid != null && ms != MotionStance.DualWieldAttack) { //WorldObject meleeWeapon = GetInventoryItem(new ObjectGuid(mEquipedMelee.Guid)); WorldObject meleeWeapon = GetEquippedWeapon(); if (meleeWeapon == null) { log.InfoFormat("Changing combat mode for {0} - could not locate wielded weapon {1}", Guid, mEquipedMelee.Guid); return; } if (!shieldEquiped) { if (meleeWeapon.DefaultCombatStyle != null) { cs = meleeWeapon.DefaultCombatStyle.Value; switch (cs) { case CombatStyle.Atlatl: ms = MotionStance.AtlatlCombat; break; case CombatStyle.Sling: ms = MotionStance.SlingAttack; break; case CombatStyle.ThrownWeapon: ms = MotionStance.ThrownWeaponAttack; break; default: ms = MotionStance.MeleeNoShieldAttack; break; } } } else { switch (meleeWeapon.DefaultCombatStyle) { case CombatStyle.Unarmed: case CombatStyle.OneHanded: case CombatStyle.OneHandedAndShield: case CombatStyle.TwoHanded: case CombatStyle.DualWield: case CombatStyle.Melee: ms = MotionStance.MeleeShieldAttack; break; case CombatStyle.ThrownWeapon: ms = MotionStance.ThrownShieldCombat; break; ////case CombatStyle.Unarmed: //// ms = MotionStance.MeleeShieldAttack; //// break; default: log.InfoFormat( "Changing combat mode for {0} - unable to determine correct combat stance for weapon {1}", Guid, mEquipedMelee.Guid); return; } } } if (ms != MotionStance.Invalid) { UniversalMotion mm = new UniversalMotion(ms); mm.MovementData.CurrentStyle = (ushort)ms; SetMotionState(this, mm); var player = this as Player; if (player != null) { player.Session.Network.EnqueueSend(new GameMessagePrivateUpdatePropertyInt(this, PropertyInt.CombatMode, (int)CombatMode.Melee)); } } else { log.InfoFormat("Changing combat mode for {0} - wielded item {1} has not be assigned a default combat style", Guid, mEquipedMelee?.Guid ?? mEquipedTwoHanded?.Guid); } }
public static Record CreateRecord(string Tag) { Record outRecord; switch (Tag) { case "TES4": outRecord = new Header(); break; case "GMST": outRecord = new GameSetting(); break; case "TXST": outRecord = new TextureSet(); break; case "MICN": outRecord = new MenuIcon(); break; case "GLOB": outRecord = new GlobalVariable(); break; case "CLAS": outRecord = new Class(); break; case "FACT": outRecord = new Faction(); break; case "HDPT": outRecord = new HeadPart(); break; case "HAIR": outRecord = new Hair(); break; case "EYES": outRecord = new Eyes(); break; case "RACE": outRecord = new Race(); break; case "SOUN": outRecord = new Sound(); break; case "ASPC": outRecord = new AcousticSpace(); break; case "MGEF": outRecord = new MagicEffect(); break; case "SCPT": outRecord = new Script(); break; case "LTEX": outRecord = new LandscapeTexture(); break; case "ENCH": outRecord = new ObjectEffect(); break; case "SPEL": outRecord = new ActorEffect(); break; case "ACTI": outRecord = new ESPSharp.Records.Activator(); break; case "TACT": outRecord = new TalkingActivator(); break; case "TERM": outRecord = new Terminal(); break; case "ARMO": outRecord = new Armor(); break; case "BOOK": outRecord = new Book(); break; case "CONT": outRecord = new Container(); break; case "DOOR": outRecord = new Door(); break; case "INGR": outRecord = new Ingredient(); break; case "LIGH": outRecord = new Light(); break; case "MISC": outRecord = new MiscItem(); break; case "STAT": outRecord = new Static(); break; case "SCOL": outRecord = new StaticCollection(); break; case "MSTT": outRecord = new MoveableStatic(); break; case "PWAT": outRecord = new PlaceableWater(); break; case "GRAS": outRecord = new Grass(); break; case "TREE": outRecord = new Tree(); break; case "FURN": outRecord = new Furniture(); break; case "WEAP": outRecord = new Weapon(); break; case "AMMO": outRecord = new Ammunition(); break; case "NPC_": outRecord = new NonPlayerCharacter(); break; case "CREA": outRecord = new Creature(); break; case "LVLC": outRecord = new LeveledCreature(); break; case "LVLN": outRecord = new LeveledNPC(); break; case "KEYM": outRecord = new Key(); break; case "ALCH": outRecord = new Ingestible(); break; case "IDLM": outRecord = new IdleMarker(); break; case "NOTE": outRecord = new Note(); break; case "COBJ": outRecord = new ConstructibleObject(); break; case "PROJ": outRecord = new Projectile(); break; case "LVLI": outRecord = new LeveledItem(); break; case "WTHR": outRecord = new Weather(); break; case "CLMT": outRecord = new Climate(); break; case "REGN": outRecord = new Region(); break; case "NAVI": outRecord = new NavigationMeshInfoMap(); break; case "DIAL": outRecord = new DialogTopic(); break; case "QUST": outRecord = new Quest(); break; case "IDLE": outRecord = new IdleAnimation(); break; case "PACK": outRecord = new Package(); break; case "CSTY": outRecord = new CombatStyle(); break; case "LSCR": outRecord = new LoadScreen(); break; case "ANIO": outRecord = new AnimatedObject(); break; case "WATR": outRecord = new Water(); break; case "EFSH": outRecord = new EffectShader(); break; case "EXPL": outRecord = new Explosion(); break; case "DEBR": outRecord = new Debris(); break; case "IMGS": outRecord = new ImageSpace(); break; case "IMAD": outRecord = new ImageSpaceAdapter(); break; case "FLST": outRecord = new FormList(); break; case "PERK": outRecord = new Perk(); break; case "BPTD": outRecord = new BodyPartData(); break; case "ADDN": outRecord = new AddonNode(); break; case "AVIF": outRecord = new ActorValueInformation(); break; case "RADS": outRecord = new RadiationStage(); break; case "CAMS": outRecord = new CameraShot(); break; case "CPTH": outRecord = new CameraPath(); break; case "VTYP": outRecord = new VoiceType(); break; case "IPCT": outRecord = new Impact(); break; case "IPDS": outRecord = new ImpactDataSet(); break; case "ARMA": outRecord = new ArmorAddon(); break; case "ECZN": outRecord = new EncounterZone(); break; case "MESG": outRecord = new Message(); break; case "RGDL": outRecord = new Ragdoll(); break; case "DOBJ": outRecord = new DefaultObjectManager(); break; case "LGTM": outRecord = new LightingTemplate(); break; case "MUSC": outRecord = new MusicType(); break; case "IMOD": outRecord = new ItemMod(); break; case "REPU": outRecord = new Reputation(); break; case "RCPE": outRecord = new Recipe(); break; case "RCCT": outRecord = new RecipeCategory(); break; case "CHIP": outRecord = new CasinoChip(); break; case "CSNO": outRecord = new Casino(); break; case "LSCT": outRecord = new LoadScreenType(); break; case "MSET": outRecord = new MediaSet(); break; case "ALOC": outRecord = new MediaLocationController(); break; case "CHAL": outRecord = new Challenge(); break; case "AMEF": outRecord = new AmmoEffect(); break; case "CCRD": outRecord = new CaravanCard(); break; case "CMNY": outRecord = new CaravanMoney(); break; case "CDCK": outRecord = new CaravanDeck(); break; case "DEHY": outRecord = new DehydrationStage(); break; case "HUNG": outRecord = new HungerStage(); break; case "SLPD": outRecord = new SleepDeprivationStage(); break; case "CELL": outRecord = new Cell(); break; case "WRLD": outRecord = new Worldspace(); break; case "LAND": outRecord = new GenericRecord(); break; case "NAVM": outRecord = new NavigationMesh(); break; case "INFO": outRecord = new DialogResponse(); break; case "REFR": outRecord = new Reference(); break; case "ACHR": outRecord = new PlacedNPC(); break; case "ACRE": outRecord = new PlacedCreature(); break; case "PGRE": outRecord = new PlacedGrenade(); break; case "PMIS": outRecord = new PlacedMissile(); break; default: Console.WriteLine("Encountered unknown record: " + Tag); outRecord = new GenericRecord(); break; } outRecord.Tag = Tag; return(outRecord); }
void Update() { if (currentHealth <= 0) { // Die dying = true; if (dying && Time.time >= dyingStartTime + 1f) { // Game over, open menu GameObject.Find("Canvas").GetComponent <GameOverMenu>().EnterMenu(false); currentHealth = maxHealth; // Reset health } else { return; } } else if (transform.position.x > 180.0f && GameObject.FindGameObjectsWithTag("Enemy").Length == 0) { // If gone through the map and no more enemies, the game is over and you have won // Game over, open menu GameObject.Find("Canvas").GetComponent <GameOverMenu>().EnterMenu(true); currentHealth = maxHealth; // Reset health } // Move the character based on input and update the animator float horizontalInput = Input.GetAxis("Horizontal"); if (horizontalInput == 0) { animator.SetBool("isWalking", false); } else { animator.SetBool("isWalking", true); } body.velocity = new Vector2(horizontalInput * horizontalSpeed, body.velocity.y); // Flip the character sprite if (horizontalInput > 0.01f) { facingForward = true; transform.localScale = Vector2.one; } else if (horizontalInput < -0.01f) { facingForward = false; transform.localScale = new Vector2(-1, 1); } // Check if we need to jump if (Input.GetKey(KeyCode.Space) && grounded) { Jump(); } // Check if we need to switch the combat style if (Input.GetAxis("Mouse ScrollWheel") != 0 && !sheatingSword && !drawingSword) { SwitchCombatStyle(); } // Check if we need to attack if (Input.GetMouseButtonDown(0) && currentStyle.Equals(CombatStyle.MELEE) && !sheatingSword) { if (Time.time >= attackStartTime + attack1Duration) { Attack(); } } // Finish switching to telekinesis with cooldown if (sheatingSword) { updatesSinceSwitching += Time.deltaTime; if (updatesSinceSwitching >= combatSwitchCooldown) { currentStyle = CombatStyle.TELEKINESIS; GameObject.Find("DragPoint").GetComponent <Drag>().enabled = true; updatesSinceSwitching = 0; sheatingSword = false; } } // Finish switching to melee with cooldown if (drawingSword) { updatesSinceSwitching += Time.deltaTime; if (updatesSinceSwitching >= combatSwitchCooldown) { updatesSinceSwitching = 0; drawingSword = false; } } }
public Player(int id, string name, int level, int baseHealth, int gold, CombatStyle combatStyle, List <Item> inventory, List <Skill> skills) : base(id, name, level, baseHealth, 2, gold, inventory, skills) { CombatStyle = combatStyle; }
public Player(int id, string name, CombatStyle combatStyle) : this(id, name) { CombatStyle = combatStyle; }