source: 2015/26/MikkoL/JRPG/JRPG/JRPG/Battle/AttackList.cs @ 6305

Revision 6305, 1.9 KB checked in by mijoliim, 6 years ago (diff)
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Jypeli;
6
7public static class AttackList
8{
9    public static AttackBase Attack()
10    {
11        AttackBase Attack = new AttackBase();
12        Attack.Name = "attack";
13        Attack.DMG = 5;
14        Attack.LearnAtLevel = 1;
15
16        Attack.OnUse = delegate {
17            BattleView.CurrentBattleView.SelectSingleEnemyForAttackTarget(AttackList.Attack());
18        };
19
20        return Attack;
21    }
22
23    public static AttackBase SpookyAttack()
24    {
25        AttackBase SpookyAttack = new AttackBase();
26        SpookyAttack.DMG = 10;
27
28        SpookyAttack.OnUse = delegate
29        {
30            BattleView.CurrentBattleView.Attacker.CanMakeAction = false;
31            EnemyBase user = BattleView.CurrentBattleView.Attacker;
32
33            CharacterBase character = BattleView.CurrentBattleView.SelectRandomAlly();
34
35            double BaseDamage = SpookyAttack.BaseDamage(user.Stats.Str, 2);
36            int TrueDamage = BattleAlgorithms.DamageFromBasicAttack(BaseDamage, character.CurrentStats.Def);
37            character.CurrentHP.Value -= TrueDamage;
38
39            if(SoundEffects.Battle.Hit_01.IsPlaying)
40            {
41                SoundEffects.Battle.Hit_01.Stop();
42            }
43            SoundEffects.Battle.Hit_01.Play();
44
45            BattleView.CurrentBattleView.IsAttackAnimationPlaying = false;
46            BattleView.CurrentBattleView.IsTimerActive = true;
47        };
48
49        return SpookyAttack;
50    }
51}
52
53public class AttackBase
54{
55    public string Name { get; set; }
56    public int LearnAtLevel { get; set; }
57
58    public int DMG { get; set; }
59    public double BaseDamage(int Str, int Lvl)
60    {
61        return DMG * Lvl + Str;
62    }
63   
64    public int HitPercent = 100;
65
66    public Action OnUse { get; set; }
67    public Action Animation { get; set; }
68}
Note: See TracBrowser for help on using the repository browser.