rpg maker mv damage formula 미완성
그 외 일기,교훈 2018. 3. 13. 20:19 |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(a.hp, 3)
=
(a.hp) ^ 3) (rpg maker 외에선 이렇게 표기)
=
체력의 3제곱 (체력을 3번 곱함)
로그값 표현은 이렇게 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
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)
Y: ID of darkness element
Z: Id of state you want to add