| |

VerySource

 Forgot password?
 Register
Search
View: 1466|Reply: 12

Skill Damage Algorithm

[Copy link]

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-1-25 19:20:01
| Show all posts |Read mode
Who helped write a few simple common RPG skill damage algorithms
Thank you
Reply

Use magic Report

0

Threads

8

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-6 03:30:01
| Show all posts
Does this need someone else to write it ?? How do you set the rules and how do others know?
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-3-12 17:00:01
| Show all posts
Are all self-defined
For example, attack power * N1-defense power * N2 + random fluctuation range
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-3-13 08:00:01
| Show all posts
`` `The specific code is not, but I describe a paragraph
Suppose the protagonist S (int HP, int MP, int lev, string name `` `public int sHP (); public int sMP (); '');
Skill class Sskill (int damage, int costMP, int costHP, string name```)

Suppose the enemy E (int HP, int MP, int lev, string name````);
Skill class Eskill (int damage, int costMP, int costHP, string name````)
War war; // class War () returns true to enter the battle interface
S s = new S ();
E e = new E ();
if (war == true) {
s.sHP- = e.damege;
e.eMP- = e.costMP;
e.eHP- = e.costHP;
}
`` `` `` `` `` `` `` `` `` `` `` ``
// The description is not very good, but probably the RPGs that do this are basically turn-based
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-10 16:45:01
| Show all posts
Well, my RPG battles are round

The framework has been designed, but I have n’t researched and planned it. I do n’t know how to hurt it. It ’s more reasonable. Of course, anyone with a +-* / algorithm will look at it.
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-12 09:15:02
| Show all posts
It ’s best not to rely on a method for the algorithm of injury, but to use the interface,

For example, all types of units have
int getPAttack (); // Physical Attack
int getMAttack (); // Magic attack power
int getPAttackType (); // Physical attack type
int getMAttackType (); // Magic attack type
int getPDefence (int pType); // Defense for a certain type of physical attack
... there are attack rewards / coefficients, defense rewards / coefficients, immunity, hit rate / MISS rate, distance coefficient, height coefficient, random coefficient, etc.

int computeDamage (Unit atk, Unit def) {
  int pDmg = atk.getPAttack ()-def.getPDefence (atk.getPAttackType ());
  int mDmg = atk.getMAttack ()-def.getMDefence (atk.getMAttackType ());
  int dmg = pDmg + mDmg ........;
}

In this way, each class of arms overrides / implement these methods, and returns different values ​​according to the current state of the unit, and then calculates
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-4-12 10:30:01
| Show all posts
The basic attributes mentioned above are written in the configuration file to facilitate the adjustment of the game balance
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-12 23:30:02
| Show all posts
Upstairs enlightenment. Do you mean that after entering the battle, first get the attributes of the arms for calculation?
Can you write two simple algorithms specifically, such as the formula of MISS rate and crit rate?
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-12 23:45:01
| Show all posts
Upstairs enlightenment. Do you mean that after entering the battle, first get the attributes of the arms for calculation? Can you write two simple algorithms specifically, such as the formula of MISS rate and crit rate?
Reply

Use magic Report

0

Threads

3

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-15 16:30:01
| Show all posts
Interface is a good way. If you really want to make the damage reasonable and playable-it is recommended to make a relatively simple mathematical model The landlord can go to find out the code of these games is available on the Internet, and the mathematical models built by others can be applied. Recommend a few models of the game wow (the game was played more as a kid ~! ~) "Eating World", "Holy Fire Badge", "Link Adventure" (suitable for ARPG), "Pokemon" (no code online, but very classic ). Others are not recommended.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list