void OnExecuteAttack() { currentChar = null; target = null; skill = null; ChangeTurn(); }
public float calculateConeAngle(ICharacterStats attacker, ICharacterStats victim) { // Angle = ( width of object / ( hitRatio * distance )) * ( 180/pi ) float angle = (objectWidth / (chanceToHit * distance)) * (180 / (float)Math.PI); return angle; }
public ICharacter WithStats(ICharacterStats stats) { var character = MakeCopy(this); character.Stats = stats; return(character); }
public ILoginRequestGrantedData WithCharacterStats(ICharacterStats stats) { var copy = MakeCopy(this); copy.CharacterStats = stats; return(copy); }
// Start is called before the first frame update private void OnMouseDown() { ICharacterStats[] team = new ICharacterStats[4] { new Artorias_Character(), new Artorias_Character(), new Artorias_Character(), new Artorias_Character() }; MainManager.playersTeam.team = team; SceneManager.LoadScene("SampleScene"); }
private void OnTurnChanges() { character = MainManager.battleManager.currentChar; statsText = $"HP:{character.curHealthPoints}/{character.maxHealthPoints}\t Armor:{character.armor} \n" + $"CP:{character.maxConcentrationPoints}\nDamage:{character.baseDamage}\nSpeed:{character.baseSpeed}" + $"Weapon:{character.weaponLevel}\t Armor{character.armorLevel}"; stats.text = statsText; }
public Damage damageDealt(ICharacterStats attacker, IWeaponStats weapon, ICharacterStats victim) { //** DAMAGE CALCULATION **// // damagePoints = weaponPower * modifiers - defence int damagePoints; float modifiers; int defence; // modifiers = critModifier * evasionModifier * luckModifier float critModifier = 1; float evasionModifier = 1; float luckModifier = 1; // Generate random number between 0 and 1. If number is within Luck // apply critical modifier to damage. if (rand.NextDouble() <= attacker.getLuck()) { critModifier = weapon.getCritical(); } modifiers = critModifier * evasionModifier * luckModifier; // defence = defence + armour defence = victim.getDefense() + victim.getArmour(); damagePoints = (int)(weapon.getPower() * modifiers - defence); //** STATUS **// // If the random number is within the victims Evasion %, the victim // will dodge. if (rand.NextDouble() <= victim.getEvasion()) { return new Damage(Status.MISS, damagePoints); } // If the distance between the attacker and victim exceeds the // the weapon range, reduce the chanceToHit. if (weapon.getRange() < distance) { chanceToHit *= (weapon.getRange() / distance); } // Determine whether the shot is a hit or miss. if (rand.NextDouble() > chanceToHit) { return new Damage(Status.MISS, damagePoints); } return new Damage(Status.HIT, damagePoints); }
private IEnumerator isEnemyAttack() { target = MainManager.playersTeam.team[rand.Next(0, 4)]; yield return(new WaitForSecondsRealtime(1.5f)); target.TakeDamage(currentChar.baseDamage); //currentChar.go.GetComponent<Renderer>().material.color = Color.white; ExecuteAttack.Invoke(); }
public override void Initialize(ICharacterStats character) { SpriteRenderer sp = gameObject.AddComponent <SpriteRenderer>(); sp.sprite = Resources.Load <Sprite>("Prefabs/lamia"); gameObject.AddComponent <BoxCollider2D>(); this.character = character; this.character.link = this; }
public bool BordelAdd(ICharacterStats chara) { if (curBordel < maxBordel) { bordel.Add(chara); curBordel++; return(true); } return(false); }
public bool BarAdd(ICharacterStats chara) { if (curBar < maxBar) { bar.Add(chara); curBar++; return(true); } return(false); }
public bool CasinoAdd(ICharacterStats chara) { if (curCasino < maxCasino) { casino.Add(chara); curCasino++; return(true); } return(false); }
public bool RoomAdd(ICharacterStats chara) { if (curRoom < maxRoom) { room.Add(chara); curRoom++; return(true); } return(false); }
protected override void OnUpdateControl(GameTime gameTime) { if (_lastCharacterStats != _characterProvider.MainCharacter.Stats || _lastCharacterGold != CurrentCharacterGold) { _lastCharacterStats = _characterProvider.MainCharacter.Stats; _lastCharacterGold = CurrentCharacterGold; _basicStats[STR].Text = $"{_lastCharacterStats[CharacterStat.Strength]}"; _basicStats[INT].Text = $"{_lastCharacterStats[CharacterStat.Intelligence]}"; _basicStats[WIS].Text = $"{_lastCharacterStats[CharacterStat.Wisdom]}"; _basicStats[AGI].Text = $"{_lastCharacterStats[CharacterStat.Agility]}"; _basicStats[CON].Text = $"{_lastCharacterStats[CharacterStat.Constituion]}"; _basicStats[CHA].Text = $"{_lastCharacterStats[CharacterStat.Charisma]}"; _characterStats[HP].Text = $"{_lastCharacterStats[CharacterStat.HP]}"; _characterStats[TP].Text = $"{_lastCharacterStats[CharacterStat.TP]}"; _characterStats[DAM].Text = $"{_lastCharacterStats[CharacterStat.MinDam]} - {_lastCharacterStats[CharacterStat.MaxDam]}"; _characterStats[ACC].Text = $"{_lastCharacterStats[CharacterStat.Accuracy]}"; _characterStats[ARM].Text = $"{_lastCharacterStats[CharacterStat.Evade]}"; _characterStats[EVA].Text = $"{_lastCharacterStats[CharacterStat.Armor]}"; _otherInfo[WEIGHT].Text = $"{_lastCharacterStats[CharacterStat.Weight]} / {_lastCharacterStats[CharacterStat.MaxWeight]}"; _otherInfo[STATPTS].Text = $"{_lastCharacterStats[CharacterStat.StatPoints]}"; _otherInfo[SKILLPTS].Text = $"{_lastCharacterStats[CharacterStat.SkillPoints]}"; _otherInfo[ELEM].Text = ""; //Elements are not supported by Endless Online :( _otherInfo[GOLD].Text = $"{CurrentCharacterGold.Amount}"; _otherInfo[EXP].Text = $"{_lastCharacterStats[CharacterStat.Experience]}"; _otherInfo[TNL].Text = $"{ExperienceToNextLevel}"; _otherInfo[KARMA].Text = $"{_lastCharacterStats[CharacterStat.Karma]}"; _characterInfo[NAME].Text = $"{_characterProvider.MainCharacter.Name}"; _characterInfo[GUILD].Text = $"{_characterProvider.MainCharacter.GuildName}"; _characterInfo[LEVEL].Text = $"{_lastCharacterStats[CharacterStat.Level]}"; if (_lastCharacterStats.Stats[CharacterStat.StatPoints] > 0) { foreach (var button in _arrowButtons.OfType <XNAButton>()) { button.Visible = true; } } else { foreach (var button in _arrowButtons.OfType <XNAButton>()) { button.Visible = false; } _confirmedTraining = false; } } base.OnUpdateControl(gameTime); }
protected virtual IEnumerator _OnStay(ICharacterStats character, IStat statToChange, Collider other) { // Keeps going forever untill StopCoroutine is called. while (true) { yield return(_onStayWaitForSeconds); ChangeStat(statToChange, other, onStayChangeAmount); if (OnStay != null) { OnStay(character, statToChange); } } }
/* public void OnTurnChanges() * { * if(MainManager.battleManager.currentChar==character) * { * Debug.Log(name); * } * }*/ public override void Initialize(ICharacterStats character) { SpriteRenderer sp = gameObject.AddComponent <SpriteRenderer>(); sp.sprite = Resources.Load <Sprite>("Prefabs/ArtoriasStandBattle"); gameObject.AddComponent <BoxCollider2D>(); this.character = character; this.character.link = this; /* HealthBarManager hBar = gameObject.AddComponent<HealthBarManager>(); * hBar.Initialize(character);*/ //hBar.RefreshPos(); //MainManager.battleManager.OnTurnChangesEvent += OnTurnChanges; }
public bool AddToList(ICharacterStats chara) { bool result; switch (curType) { case RelaxType.Bar: { result = BarAdd(chara); break; } case RelaxType.Casino: { result = CasinoAdd(chara); break; } case RelaxType.Bordel: { result = BordelAdd(chara); break; } case RelaxType.Room: { result = RoomAdd(chara); break; } default: result = false; break; } if (result == true) { busyChars.Add(chara); } return(result); }
public void Attack(ICharacterStats target) { if (target == null) { Debug.LogWarning("Attack called without target"); return; } if (_remainingCooldown > 0) { return; } Debug.Log($"{_source?.name ?? "Unknown"} attacks {target.GameObject?.name} with {_name} for {_damage}"); Animate(); target.TakeDamage(_damage); _remainingCooldown = _cooldown; }
ICharacterStats FindFastAsFuck() { ICharacterStats currentChar = currentTurnCharacters[0]; foreach (var temp in currentTurnCharacters) { if (temp.baseSpeed > currentChar.baseSpeed) { currentChar = temp; } } currentTurnCharacters.Remove(currentChar); // Debug.Log(currentChar.name); SkillExecute.character = currentChar; return(currentChar); }
void WriteCharacterStatFiles(ICharacterStats characterData) { WriteStatFile("name", characterData.Name); WriteStatFile("level", characterData.Level); WriteStatFile("strength", characterData.Strength); WriteStatFile("dexterity", characterData.Dexterity); WriteStatFile("vitality", characterData.Vitality); WriteStatFile("energy", characterData.Energy); WriteStatFile("fire_res", characterData.FireResist); WriteStatFile("cold_res", characterData.ColdResist); WriteStatFile("light_res", characterData.LightningResist); WriteStatFile("poison_res", characterData.PoisonResist); WriteStatFile("gold", characterData.Gold + characterData.GoldStash); WriteStatFile("deaths", characterData.Deaths); WriteStatFile("fcr", characterData.FasterCastRate); WriteStatFile("frw", characterData.FasterRunWalk); WriteStatFile("fhr", characterData.FasterHitRecovery); WriteStatFile("ias", characterData.IncreasedAttackSpeed); }
void OnTurnChanges() { if (currentTurnCharacters.Count < 1) { RefreshCurChars(); } currentChar = FindFastAsFuck(); // currentChar.go.transform.localScale += new Vector3(.2f, .2f, .2f); // currentChar.go.GetComponent<Renderer>().material.color = Color.red; if (currentChar.charType == CharacterType.Ally) { currentTurn = TurnType.Player; Switch.Invoke(); } else { currentTurn = TurnType.Enemy; OnEnemyAttack(); } }
GameObject getPrefab(ICharacterStats chara) { GameObject temp = Instantiate(Resources.Load <GameObject>("Prefabs/CharacterSelectPrefab")); switch (chara.charClass) { case CharClassEnum.Artorias: { ArtoriasPicker picker = temp.AddComponent(typeof(ArtoriasPicker)) as ArtoriasPicker; picker.character = chara; break; } case CharClassEnum.Lamia: { LamiaPicker picker = temp.AddComponent(typeof(LamiaPicker)) as LamiaPicker; picker.character = chara; break; } } return(temp); }
public void RemoveFromList(ICharacterStats chara) { switch (curType) { case RelaxType.Bar: { bar.Remove(chara); curBar--; break; } case RelaxType.Casino: { casino.Remove(chara); curCasino--; break; } case RelaxType.Bordel: { bordel.Remove(chara); curBordel--; break; } case RelaxType.Room: { room.Remove(chara); curRoom--; break; } } busyChars.Remove(chara); }
public List <ICharacterStats> LoadData() { string json = File.ReadAllText(Application.dataPath + "jjjjsave.txt"); string[] splitedJson = json.Split(new string[] { SEPARATOR }, System.StringSplitOptions.None); characters = new List <ICharacterStats>(); // Debug.Log(splitedJson); foreach (string i in splitedJson) { if (i != "") { CharClassEnum typeEnum = (CharClassEnum)Enum.Parse(typeof(CharClassEnum), (i.Substring(i.IndexOf("charClass") + 11, 1))); System.Type type = Tools.EnumToCharClass(typeEnum); //var character = Activator.CreateInstance(type); ICharacterStats character = JsonUtility.FromJson(i, type) as ICharacterStats; characters.Add(character); } } return(characters); }
public static void AddCharacter(ICharacterStats chara) { availableCharacters.Add(chara); }
public abstract void Initialize(ICharacterStats character);
public void CreateTarget() { _target = Substitute.For <ICharacterStats>(); }
public void WriteFiles(ICharacterStats characterData) { EnsureStatFileDirectoryExists(); WriteCharacterStatFiles(characterData); }
public static void RemoveCharacter(ICharacterStats chara) { availableCharacters.Remove(chara); }