public SkilletteResponse takeStatus(StatusEffect _se) { SkilletteResponse response = new SkilletteResponse(); switch (_se.statusType) { case STATUSEFFECTTYPE.DEFENSEBREAK: case STATUSEFFECTTYPE.ATTACKBREAK: default: bool found = false; foreach (StatusEffect se in this.statusEffects) { if (se.statusType == _se.statusType) { se.duration = se.duration > _se.duration ? se.duration : _se.duration; found = true; } } if (!found) { this.statusEffects.Add(_se); CalculateStatusEffectModifiers(); } break; } return(response); }
public void PlayerTurnChoice(Monster _curr, int _skill, Monster _target, Transform _targetTransform) { if (myState != GAMESTATE.PLAYERTURN) { return; } Skill chosen = _curr.skills[_skill - 1]; foreach (Skillette _s in chosen.skillettes) { int totalDamage = 0; for (int i = 0; i < 6; i++) { if (i == 0) { totalDamage += (int)(_curr.matchStats[i] * _s.damageScaling[i]); } else { totalDamage += (int)(_curr.currentStats[i] * _s.damageScaling[i]); } } //check for critical strike //roll for debuff int damageDone = _target.takeDamage(totalDamage); //probably should make an attack object with damage and damage type and other things SkilletteResponse response = new SkilletteResponse(); response.damageDone = damageDone; GameObject bText = Instantiate(battleText, _targetTransform.position, Quaternion.identity); bText.transform.GetChild(0).GetComponent <TextMesh>().text = damageDone.ToString(); //add flags for debuffs landed or other events like KO'ing a monster foreach (StatusEffect debuff in _s.debuffs) { float chance = 0f; chance = (float)_curr.currentAccuracy / ((float)_curr.currentAccuracy + (float)_target.currentResistance); //Debug.Log($"my chance to land a Debuff is {chance}"); if (Rand.value < chance) { //debuff name //debuff type //debuff duration //count on turn start/end SkilletteResponse SER = _target.takeStatus(new StatusEffect(debuff)); } } //merge dictionary of effects that happened this skillette chosen.OnSkillEnd(response); } //myState = GAMESTATE.RUNNING; // to allow for animations //run monster skill _skill //Debug.Log($"using skill {_skill}!"); _curr.attackBar.Zero(); _curr.OnTurnEnd(); myState = GAMESTATE.TICKING; }
public override void OnSkillEnd(SkilletteResponse _sr) { //gain 30% life from damage done //dynamic dam; //_sr.flags.TryGetValue("damageDealt", out dam); //monster gain 30% of dam int gain = (int)Math.Floor(_sr.damageDone * 0.3); myMonster.gainHealth(gain); Debug.Log($"{myMonster.name} gains {gain} from Bite"); }
public void Respond(SkilletteResponse _sr) { Debug.Log("i dealt " + _sr.damageDone + " damage to " + _sr.target.name); }
public virtual void OnSkillEnd(SkilletteResponse _sr) { }
public override void OnSkillEnd(SkilletteResponse _sr) { }