public static Ability GetAbility(CharacterClasses playerClass, GameObject go) { Ability ability = new DashAbility(go); switch (playerClass) { case CharacterClasses.Melee: ability = new DashAbility(go); break; case CharacterClasses.Bowman: ability = new InvisibilityAbility(go); break; case CharacterClasses.Magician: ability = new SiphonAoeBlood(go); break; case CharacterClasses.Dartblower: ability = new ImmolationAbility(go); break; default: break; } return(ability); }
public static UICharacterClass ToUiCharacterClass( this CharacterClasses characterClasses) { var uiCharacterClass = UICharacterClass.Knight; switch (characterClasses) { case CharacterClasses.Knight: { uiCharacterClass = UICharacterClass.Knight; break; } case CharacterClasses.Arrow: { uiCharacterClass = UICharacterClass.Arrow; break; } case CharacterClasses.Wizard: { uiCharacterClass = UICharacterClass.Wizard; break; } } return(uiCharacterClass); }
public void addClass() { CharacterClasses.AddItem(new CharacterClass { Id = (CharacterClassType)9, Name = "Danmaku", Description = "Danmaku class made for Millie", Victory = (Unlock)54, Level5 = ItemId.StaffOfLordSeigen, Level10 = ItemId.FieldRepair, Level15 = ItemId.Seeker, Level20 = (ItemId)ItemEnum.DoublePen, IsPremium = false, OnSpawn = delegate(Player player) { player.Coins = 0; player.Keys = 0; player.Bombs = 1; player.Speed = 3f; player.Damage = 3f; player.BulletSpeed = 35f; player.AttackRate = 60f; player.Range = 6f; player.Health.NetworkMaxHealth = 0.5f; player.Health.Health = player.Health.MaxHealth; if (player.isLocalPlayer) { //Adding items if needed } } }); }
public CreateCharacterRequestParametersEx(int userId, CharacterClasses characterClass, string name, CharacterIndex characterIndex) { UserId = userId; CharacterClass = characterClass; Name = name; Index = characterIndex; }
public void Deserialize(BinaryReader reader) { UserId = reader.ReadInt32(); CharacterClass = (CharacterClasses)reader.ReadByte(); Name = reader.ReadString(); Index = (CharacterIndex)reader.ReadByte(); }
/// <summary> /// Attempts to read a Name predicate starting from the current position. The name predicate <b>must</b> be followed /// by a white space. If the Name predicate is succesfully parsed the function returns true and the <b>name</b> /// parameter will be intialized with the name read. If the predicate is nor recognized then the function returns false, /// <b>name</b> output parameter will have a value of <b>null</b> and the position will be restored to the current /// possition before the function was called. If the predicate is recognized and parsed the position remains on the /// white space immediately after the predicate. /// </summary> /// <param name="name"></param> /// <returns></returns> protected override unsafe bool ReadNamePredicate(out string name) { //[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender //[5] Name ::= (Letter | '_' | ':') (NameChar)* name = null; long startPos = (long)m_RawDataPtr; if (!CharacterClasses.IsLetter(m_RawDataPtr) && *m_RawDataPtr != '_' && *m_RawDataPtr != ':') { // Restore the starting position as the parsing was unsuccesfull m_RawDataPtr = (char *)startPos; return(false); } if (ReadChar()) { while (CharacterClasses.IsNameChar(m_RawDataPtr)) { if (!ReadChar()) { // Restore the starting position as the parsing was unsuccesfull m_RawDataPtr = (char *)startPos; return(false); } } name = GetParsedDataString((char *)startPos); } return(true); }
public static void Create() { List <Character> characters = Game.CurrentPlayer.Characters; if (characters.Count < Constants.MaxCharacters) { Menu.Announce("Create new character"); while (true) { Console.WriteLine($"Choose a name for your character{Constants.BackMessage}:"); string name = Command.ParseAlphaCommand(); if (name.Equals(Constants.BackCommand)) { return; } else if (name.Length < nameLength) { Console.WriteLine("Name must be at least 4 characters long and must contain only letters.\n"); continue; } else if (characters.Find(c => c.Name.Equals(name)) != null) { Console.WriteLine("Character with that name already exists.\n"); continue; } while (true) { Console.WriteLine("Choose a class:"); // Get all classes string[] classNames = CharacterClasses.Select(c => c.Name).ToArray(); Menu.ShowOptions(classNames.Select(c => c.SplitCapital()).ToArray()); // Show options to choose from int command = Command.ParseIntCommand(); if (command > 0 && command <= classNames.Length) { Type characterClass = Utility.GetType((classNames[command - 1]).ToString()); characters.Add(Activator.CreateInstance(characterClass, name) as Character); Console.WriteLine($"Character {name} created.\n"); Game.CurrentPlayer.Save(); return; } else { Console.WriteLine(Constants.InvalidCommand); continue; } } } } else { Console.WriteLine($"You have the maximum of {Constants.MaxCharacters} characters created.\n"); } }
/* * * * * * * * * * * * * * * * * * * * * * Section 8.8.7 Setting Bitwise Flags * * * * * * * * * * * * * * * * * * * * * */ void UseSettingBitwiseFlags() { CharacterClasses addClass(CharacterClasses a, CharacterClasses b) { return(a | b); } CharacterClasses newbie = CharacterClasses.Farmer; newbie = addClass(newbie, CharacterClasses.Wizard); newbie = addClass(newbie, CharacterClasses.Archer); CharacterClasses removeClass(CharacterClasses a, CharacterClasses b) { return(a ^ b); } newbie = removeClass(newbie, CharacterClasses.Wizard); bool hasClass(CharacterClasses a, CharacterClasses b) { return((a & b) == b); } bool isFarmer = hasClass(newbie, CharacterClasses.Farmer); Debug.Log("newbie is a farmer:" + isFarmer); // newbie is a farmer:True }
public static Weapon GetWeapon(CharacterClasses playerClass, GameObject go) { Weapon weapon = new Gun(go); switch (playerClass) { case CharacterClasses.Melee: weapon = new PlayerMeleeGun(go); break; case CharacterClasses.Bowman: weapon = new SpecialGun(go); break; case CharacterClasses.Magician: weapon = new ShieldGun(go); break; case CharacterClasses.Dartblower: weapon = new Gun(go); break; default: weapon = new Gun(go); break; } return(weapon); }
public static Character GetEnemyCharacter(CharacterClasses classId) { Character retEnemyChar = null; switch (classId) { case CharacterClasses.Warrior: retEnemyChar = new EnemyWarrior(); Console.WriteLine("An enemy warrior appears!\n"); break; case CharacterClasses.Mage: retEnemyChar = new EnemyMage(); Console.WriteLine("An enemy mage appears!\n"); break; case CharacterClasses.Ranger: retEnemyChar = new EnemyRanger(); Console.WriteLine("An enemy ranger appears!\n"); break; default: break; } return(retEnemyChar); }
public CharacterParameters(string name, CharacterClasses characterType, CharacterIndex characterIndex, Maps lastMap = Maps.Map_1) { Name = name; CharacterType = characterType; Index = characterIndex; HasCharacter = true; LastMap = lastMap; }
/// <summary> /// Returns a list of all used models in the configuration /// </summary> public List <string> GetUsedModelsNames() { var needToLoadModels = BluePrints.Values.OfType <IVoxelEntity>().Select(e => e.ModelName).Where(m => !string.IsNullOrEmpty(m)).ToList(); needToLoadModels.AddRange(CharacterClasses.Select(c => c.ModelName)); needToLoadModels.AddRange(TreeBluePrints.Select(c => c.SeedModel)); needToLoadModels = needToLoadModels.Distinct().ToList(); return(needToLoadModels); }
/// <summary> /// Creates the skill. /// </summary> /// <param name="number">The number.</param> /// <param name="name">The name of the skill.</param> /// <param name="characterClasses">The character classes.</param> /// <param name="damageType">Type of the damage.</param> /// <param name="damage">The damage.</param> /// <param name="distance">The distance.</param> /// <param name="abilityConsumption">The ability consumption.</param> /// <param name="manaConsumption">The mana consumption.</param> /// <param name="levelRequirement">The level requirement.</param> /// <param name="energyRequirement">The energy requirement.</param> /// <param name="leadershipRequirement">The leadership requirement.</param> /// <param name="elementalModifier">The elemental modifier.</param> /// <param name="skillType">Type of the skill.</param> /// <param name="skillTarget">The skill target.</param> /// <param name="implicitTargetRange">The implicit target range.</param> /// <param name="targetRestriction">The target restriction.</param> /// <param name="movesToTarget">If set to <c>true</c>, the skill moves the player to the target.</param> /// <param name="movesTarget">If set to <c>true</c>, it moves target randomly.</param> /// <param name="cooldownMinutes">The cooldown minutes.</param> protected void CreateSkill( SkillNumber number, string name, CharacterClasses characterClasses = CharacterClasses.None, DamageType damageType = DamageType.None, int damage = 0, short distance = 0, int abilityConsumption = 0, int manaConsumption = 0, int levelRequirement = 0, int energyRequirement = 0, int leadershipRequirement = 0, ElementalType elementalModifier = ElementalType.Undefined, SkillType skillType = SkillType.DirectHit, SkillTarget skillTarget = SkillTarget.Explicit, short implicitTargetRange = 0, SkillTargetRestriction targetRestriction = SkillTargetRestriction.Undefined, bool movesToTarget = false, bool movesTarget = false, int cooldownMinutes = 0) { var skill = this.Context.CreateNew <Skill>(); this.GameConfiguration.Skills.Add(skill); skill.Number = (short)number; skill.Name = name; skill.MovesToTarget = movesToTarget; skill.MovesTarget = movesTarget; skill.AttackDamage = damage; this.CreateSkillRequirementIfNeeded(skill, Stats.Level, levelRequirement); this.CreateSkillRequirementIfNeeded(skill, Stats.TotalLeadership, leadershipRequirement); this.CreateSkillRequirementIfNeeded(skill, Stats.TotalEnergy, energyRequirement); this.CreateSkillConsumeRequirementIfNeeded(skill, Stats.CurrentMana, manaConsumption); this.CreateSkillConsumeRequirementIfNeeded(skill, Stats.CurrentAbility, abilityConsumption); skill.Range = distance; skill.DamageType = damageType; skill.SkillType = skillType; skill.ImplicitTargetRange = implicitTargetRange; skill.Target = skillTarget; skill.TargetRestriction = targetRestriction; var classes = this.GameConfiguration.DetermineCharacterClasses(characterClasses); foreach (var characterClass in classes) { skill.QualifiedCharacters.Add(characterClass); } if (elementalModifier != ElementalType.Undefined) { this.ApplyElementalModifier(elementalModifier, skill); } }
/* * Section 8.9.5 Bitwise And & * * 1248 * 1001 = 9 * 1010 = 5 * & _________ * 1000 = 1 */ void UseAndCharacterClasses() { /* & "And" also known as Ampersand * the & operator shows us what matches */ uint a = 5; // 1 + 0 + 4 = 5 uint b = 6; // 0 + 2 + 4 = 6 uint c = a & b; // 0 + 0 + 4 = 7 Debug.Log(c); // 4 CharacterClasses fighter = CharacterClasses.Fighter; ShowBits((byte)fighter); // bits in 1: // 10000000 CharacterClasses wizard = CharacterClasses.Wizard; ShowBits((byte)wizard); // bits in 4: // 00100000 CharacterClasses fighterAndWizard = fighter & wizard; ShowBits((byte)fighterAndWizard); // bits in 0: // 00000000 CharacterClasses multiClass = fighter | wizard; ShowBits((byte)multiClass); // bits in 5: // 10100000 byte andFighter = (byte)(multiClass & CharacterClasses.Fighter); ShowBits(andFighter); // bits in 1: // 10000000 byte andWizard = (byte)(multiClass & CharacterClasses.Wizard); ShowBits(andWizard); // bits in 4: // 00100000 byte andArcher = (byte)(multiClass & CharacterClasses.Archer); ShowBits(andArcher); // bits in 0: // 00000000 }
public void Deserialize(BinaryReader reader) { HasCharacter = reader.ReadBoolean(); Index = (CharacterIndex)reader.ReadByte(); if (HasCharacter) { Name = reader.ReadString(); CharacterType = (CharacterClasses)reader.ReadByte(); LastMap = (Maps)reader.ReadByte(); } }
public override void Update(float gameTime, MapClasses.Map map, ParticleManager particleManager, CharacterClasses.Character[] characters) { if (frame < 0.5f) { if (trajectory.Y < -10.0f) trajectory.Y += gameTime * 500.0f; if (trajectory.X < -10.0f) trajectory.X += gameTime * 150.0f; if (trajectory.X > 10.0f) trajectory.X -= gameTime * 150.0f; } base.Update(gameTime, map, particleManager, characters); }
/// <summary> /// /// </summary> /// <returns></returns> protected override unsafe bool ReadPubidLiteral(out string pubidLiteral) { //[12] PubidLiteral ::= '"' PubidChar* '"' | "'" (PubidChar - "'")* "'" //[13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] pubidLiteral = null; long startPos = (long)m_RawDataPtr; if (CurrentChar != '"' && CurrentChar != '\'') { // Restore the starting position as the parsing was unsuccesfull m_RawDataPtr = (char *)startPos; return(false); } char beginChar = CurrentChar; if (!ReadChar()) { // Restore the starting position as the parsing was unsuccesfull m_RawDataPtr = (char *)startPos; return(false); } long startReadingPos = (long)m_RawDataPtr; while (CharacterClasses.IsPubidChar(m_RawDataPtr) && *m_RawDataPtr != beginChar) { if (!ReadChar()) { // We have reached the end of the file // Restore the starting position as the parsing was unsuccesfull m_RawDataPtr = (char *)startPos; return(false); } } if (CurrentChar != beginChar) { // TODO: Invalid charecter in the pubidLiteral // What to do?? } pubidLiteral = GetParsedDataString((char *)startReadingPos); // Move to the next character after the closing quote ReadChar(); return(true); }
public void Create(int userId, string name, CharacterClasses characterClass, CharacterIndex characterIndex) { using (var db = databaseConnectionProvider.GetDbConnection()) { var user = new CharactersTableDefinition { UserId = userId, Name = name, CharacterType = characterClass.ToString(), CharacterIndex = (byte)characterIndex }; db.Insert(user); } }
public ActionResult AddClassToCharacter(int characterid, string classname, int level = 1) { Character character = GetCharacter(characterid).Value; CharacterClasses _class = ds.AddClassToCharacter(character, classname, level); if (_class == null) { return(NotFound("Class wasn't found")); } ClassSimpleDTO DTO = new ClassSimpleDTO(_class); return(Ok(DTO)); }
public bool RemoveClass(Character character, string className) { using var db = new PathfinderContext(); CharacterClasses _class = db.CharacterClasses.Find(character.Id, className); if (_class == null) { return(false); } db.CharacterClasses.Remove(_class); db.SaveChanges(); return(true); }
public ActionResult LevelUpClass(int characterid, string classname) { Character character = GetCharacter(characterid).Value; CharacterClasses _class = ds.LevelUp(character, classname); if (_class == null) { return(NotFound("Class wasn't found")); } ClassSimpleDTO DTO = new ClassSimpleDTO(_class); return(Ok(DTO)); }
public void ParseStatBlockData() { ParseAC_Types(); ParseAbilityScores(); int Pos = HP.IndexOf(PathfinderConstants.SPACE); if (Pos == -1) { Pos = HP.Length; } CurrentHP = Convert.ToInt32(HP.Substring(0, Pos)); SaveModifer = 0; SizeCategory = (StatBlockInfo.SizeCategories)Enum.Parse(typeof(StatBlockInfo.SizeCategories), Size); ParseClasses(); OnGoingPowers.AddRange(CharacterClasses.GetAllClassPowers()); }
/* * * * * * * * * * * * * * * * * * * Section 8.8.8 Bitwise Shortcuts * * * * * * * * * * * * * * * * * * */ void UseBitwiseShortcuts() { CharacterClasses character = CharacterClasses.Farmer; character |= CharacterClasses.Fighter; character |= CharacterClasses.Wizard; character |= CharacterClasses.Archer; character |= CharacterClasses.Thief; ShowBits((byte)character); // bits in 15: // 11110000 character ^= CharacterClasses.Fighter; ShowBits((byte)character); // bits in 14: // 01110000 }
private void CreateCharacter(CharacterClasses characterClass) { var path = string.Format(Paths.Resources.Game.Characters, characterClass); var character = Resources.Load <GameObject>(path); if (character != null) { var position = character.transform.localPosition; spawnedCharacter = Instantiate(character, transform); spawnedCharacter.transform.localPosition = position; spawnedCharacter.transform.SetAsFirstSibling(); CharacterSpawned?.Invoke(); } }
private async Task RefreshCharacterClasses() { CharacterClasses.Clear(); CharacterClassesName.Clear(); var characterClassApiServises = new CharacterClassApiServises(); var characterClasses = await characterClassApiServises.SelectCharacterClassesAsync(); var sortedCharacterClasses = from cC in characterClasses orderby cC.Name select cC; foreach (var characterClass in sortedCharacterClasses) { CharacterClassesName.Add(characterClass.Name); CharacterClasses.Add(characterClass); } }
public void CreateUnit(int pPrefabIndex, CharacterClasses pclasse, HexCell cell) { if (pPrefabIndex < specie.unitsPrefabs.Count) { GameObject toInstanciate = specie.unitsPrefabs[pPrefabIndex]; GameObject go = Instantiate(toInstanciate); Unit unit = go.GetComponent <Unit>(); unit.classe = pclasse; unit.Init(); unit.SetTeam(this); grid.AddUnit(unit, cell, Random.Range(0f, 360f)); // Add instiated unit to team units.Add(unit); } }
private Char[] CreateCharactersPool() { List <Char> chars = new List <Char>(65); if (CharacterClasses.HasFlag(CharacterClass.UpperLetters)) { chars.AddRange(PoolUpperCase.ToCharArray()); if (GeneratorFlags.HasFlag(GeneratorFlag.ExcludeLookAlike) == false) { chars.AddRange(PoolUpperCaseConflict.ToCharArray()); } } if (this.CharacterClasses.HasFlag(CharacterClass.LowerLetters)) { chars.AddRange(PoolLowerCase.ToCharArray()); if (GeneratorFlags.HasFlag(GeneratorFlag.ExcludeLookAlike) == false) { chars.AddRange(PoolLowerCaseConflict.ToCharArray()); } } if (this.CharacterClasses.HasFlag(CharacterClass.Digits)) { chars.AddRange(PoolDigits.ToCharArray()); if (GeneratorFlags.HasFlag(GeneratorFlag.ExcludeLookAlike) == false) { chars.AddRange(PoolDigitsConflict.ToCharArray()); } } if (this.CharacterClasses.HasFlag(CharacterClass.SpecialCharacters)) { chars.AddRange(PoolSpecial.ToCharArray()); if (GeneratorFlags.HasFlag(GeneratorFlag.ExcludeLookAlike) == false) { chars.AddRange(PoolSpecialConflict.ToCharArray()); } } if (CharacterClasses.HasFlag(CharacterClass.Space)) { chars.AddRange(PoolSpace.ToCharArray()); } return(chars.ToArray()); }
/* * * * * * * * * * * * * * * * * * Section 8.8.5 Bitwise Xor ^ * * * * * * * * * * * * * * * * * */ /* 1248 * * 1001 = 9 * * 1010 = 5 * * ^ _________ * * 0011 = 12 */ void UseXorCharacterClasses() { /* ^ "Xor" also known as caret * Xor shows what's different about the two * different bytes. */ uint a = 5; // 1 + 0 + 4 = 5 uint b = 6; // 0 + 2 + 4 = 6 uint c = a ^ b; // 1 + 2 + 0 = 3 Debug.Log(c); // 3 /* using | we add in a wizard to the fighter * to take the wizard flag back out use ^ */ CharacterClasses wizard = CharacterClasses.Wizard; CharacterClasses fighter = CharacterClasses.Fighter; CharacterClasses multiClass = wizard | fighter; ShowBits((byte)multiClass); // bits in 5: // 10100000 Debug.Log(multiClass); CharacterClasses result = multiClass ^ CharacterClasses.Fighter; ShowBits((byte)result); // bits in 4: // 00100000 Debug.Log(result); multiClass = CharacterClasses.Fighter | CharacterClasses.Thief | CharacterClasses.Wizard; ShowBits((byte)multiClass); // bits in 7: // 11100000 bool isThief = (multiClass & CharacterClasses.Thief) == CharacterClasses.Thief; Debug.Log("multiClass is Thief:" + isThief); // multiClass is Thief:True }
void UseOrCharacterClasses() { CharacterClasses fighter = CharacterClasses.Fighter; ShowBits((byte)fighter); // bits in 1: // 10000000 CharacterClasses wizard = CharacterClasses.Wizard; ShowBits((byte)wizard); // bits in 4: // 00100000 CharacterClasses multiClass = fighter | wizard; ShowBits((byte)multiClass); // bits in 5: // 10100000 }
/// <summary> /// Levels up the character in one of their classes, simply by adding 1 to their level. /// </summary> /// <param name="character"></param> /// <param name="className"></param> /// <returns></returns> public CharacterClasses LevelUp(Character character, string className) { using var db = new PathfinderContext(); CharacterClasses _class = db.CharacterClasses.Find(character.Id, className); if (_class == null) { return(null); } if (_class.Level == 20) { return(null); } _class.Level++; db.SaveChanges(); return(_class); }
public static void InitializeCharacterClass(CharacterClasses c) { switch (c) { case CharacterClasses.Wojownik: characterClass = Player.CharacterClasses.Wojownik; power = 1; learnedSkills[1] = new PS_Stomp(); learnedSkills[2] = new PS_Stomp(); learnedSkills[3] = new PS_Harden(); break; case CharacterClasses.Mag: characterClass = Player.CharacterClasses.Mag; strength = 1; learnedSkills[1] = new MS_FreezingShot(); learnedSkills[2] = new MS_FireBall(); learnedSkills[3] = new MS_HealingSalve(); //Console.ReadKey(); break; } }
public override void Update(float gameTime, MapClasses.Map map, ParticleManager particleManager, CharacterClasses.Character[] characters) { HitManager.CheckHit(this, characters, particleManager); KillMe(); }