https://www.rpgmakercentral.com/topic/36290-damage-formulas-101-mv-edition/


mv 공식 정리



vx ace 와 적용 공식 언어가 다르다 ;;

vx ace 참고 링크 : http://imgack.tistory.com/291





↑ 중요




랜덤값


Math.randomInt(6)

-> will generate a random integer between 0 and 5.

Math.randomInt(6) + 1

-> will generate a random integer between 1 and 6.

데미지 1~6 을 가함



Math.floor(Math.random(x)) + 1

-> will give you a random number between 1 and x, inclusive.

1~x 사이의 값





상태이상


b.isStateAffected(3) ? b.addState(8) : null; a.level * 2 + 15 + (a.mat - b.mdf)


상대가 상태이상 3 일 때 ? 

맞으면 상태이상 8 추가

아니면 안함

그리고 'a.level * 2 + 15 + (a.mat - b.mdf)' 의 데미지를 줌

I'm not sure about the : null - whether it needs to be there or not.

-> 0 쓰라던데..


(b.isStateAffected(13) ? 3.25 : 2) 

상대가 상태이상 13이면 3.25 아니면 2의 데미지


(b.hpRate <= 0.1) ? b.removeState(x); b.mhp * 0.1 : 0

상태이상 제거는 

b.removeState(x) 를 씀




= <= >= 비굣값


예시


b.hp <= 2 ? 0 : a.atk * 4 

상대의 체력이 2와 같거나 작으면 (2 포함) 

  0의 데미지를 줌

상대의 체력이  그보다 많으면 내 공격력 곱하기 4


b._hp == 1 ? 0 : a.atk * 5

상대의 체력이 1와 같으면 

0의 데미지를 줌

상대의 체력이 그보다 많으면 내 공격력 곱하기 4





Math.pow 제



Math.pow(a.hp, 3)

=

(a.hp) ^ 3)    (rpg maker 외에선 이렇게 표기)

=

체력의 3제곱 (체력을 3번 곱함)




Math.sqrt()   루트

Math.sqrt(9); // 3
Math.sqrt(2); // 1.414213562373095

Math.sqrt(1);  // 1
Math.sqrt(0);  // 0
Math.sqrt(-1); // NaN




로그값 표현은 이렇게  Math.log10(x)

 log10(10) = 1, log(100) = 2, log(1000) = 3.  (

This function grows really slowly. 

Math.log10(100) = 2

10을 2 번 제곱해야 100이 나옴



+

추가 팁

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Math/asinh


수렴 그래프 비슷한 공식을 만들고 싶으면


console.log(Math.asinh(수치));

를 써 보자



console.log(Math.asinh(0));

// expected output: 0


console.log(Math.asinh(1));

// 0.881373587019543


console.log(Math.asinh(2));

//  1.4436354751788103


console.log(Math.asinh(3));

// 1.8184464592320668

console.log(Math.asinh(4));

// 2.0947125472611012


console.log(Math.asinh(5));

// 2.3124383412727525


console.log(Math.asinh(6));

// 2.491779852644912


console.log(Math.asinh(100));

// 5.298342365610589


100까지 수치에

0~5 값이 됨




반올림은 이렇게 

Math.round(c * 0.5)




math.floor()   소수점 버림 ?


Math.floor( 45.95); //  45

Math.floor(-45.95); // -46




Syntax

Math.trunc(x)   소수점 버림


Math.trunc(13.37);    // 13

Math.trunc(42.84);    // 42

Math.trunc(0.123);    //  0

Math.trunc(-0.123);   // -0

Math.trunc('-1.123'); // -1

Math.trunc(NaN);      // NaN








적에게 랜덤한 상태이상 부여

yanfly skill core 이용

<Pre-Damage Eval>
var rr = Math.floor(Math.random() * 3);//Get a random number
if(rr==0){
target.addState(4);//state ID
}
if(rr==1){
target.addState(5);
}
if(rr==2){
target.addState(6);
}
</Pre-Damage Eval>





a.hp * 0.25 + 1

시전자의 체력 1/4 =1 의 데미지를 준다.





mp 데미지

a.gainMp(-10) 

상대 mp -10


a.gainHp

넣으면 내가 쓴 스킬에 내가 데미지 

a.gainExp(10 + (a.level - b.level) * 2); 
경험치 얻는거 조절할 수도 있음!





Math.ceil 올림

Math.ceil(NUMBER / 10) * 10


this would round any number to the highest 10 (so 12 would be 20, 101 would be 110, etc)


10보다 높은 수는 무조건 올림
12 ->20
101 -> 110


y = b._actorId === 1 ? 200 : 100; y






최대 최소 값

y = (a.atk*0.5-0.25*b.def) ; Math.max(1 , y)  1과 y 공식의 최대로 큰 값
y = (a.atk*0.5-0.25*b.def); Math.min(1 ,y)  1과 y 공식의 최소로 작은값


Math.max(10, 20);   //  20
Math.max(-10, -20); // -10
Math.max(-10, 20);  //  20






상대의 원소 수치에 따라

b.elementRate(Y) > X ? a.addState(Z) : 0 

Y: ID of darkness element

Z: Id of state you want to add

상대의 암흑 (y번) 원소 수치 가 x 보다 높으면 상태이상 z 줌




변수값

x = $gameVariable.value(id); 

이 걸 복붙한 후 x 를 사용한 공식을 쓰면됨

$gameVariables.value(3)+1

아마 이렇게 해도 될듯

V[4]
이렇게 해도 될듯


사용자의 클래스 값

a._classId === 1 ? (a.atk + a.mat - b.def + b.mdf)
 : a._classId === 2 ? (a.atk * 4 - b.def * 2)
 : a._classId === 3 ? (a.mat * 4 - b.mdf) : 0




무기가 있을 때

var w = $dataWeapons[219]; (user.hasWeapon(w)) ? 932 : 780;

- Try your original formula and see if it works.

- If it doesnt, try this one.

- If it still doesnt work, try using (user.hasWeapons(w)) instead.







턴 경과 공식

$gameTroop.turnCount() * 100
The damage it dealt was 100, 200, 300, 400, etc





반응형
Posted by 이름이 익명
: