아래처럼 공격 속도를 추가 attribute를 적용하는 코드를 작성하고 아이템에 적용을 해봤는데, 일단 공격 속도는 제대로 추가가 됨.
그런데 인챈트(날카로움) 혹은 다른 방법으로 데미지가 증가한 아이템에 적용 시, 증가된 데미지는 적용되지 않고(사라지고?) 공격 속도만 증가하는 문제가 발생함ㅠ
혹시 증가된 데미지도 적용되고 내가 추가한 공격 속도도 적용되게 하는 방법을 아는 게이가 있을까ㅠ..
function attackSpeed(p: player, weapon: itemtype, level: number):
set {_uuid1} to a random integer between -2147483647 and 2147483647
set {_uuid2} to a random integer between -2147483647 and 2147483647
set {_uuid3} to a random integer between -2147483647 and 2147483647
set {_uuid4} to a random integer between -2147483647 and 2147483647
set {_modifiedItem} to {_weapon}
set {_nbt} to nbt compound of {_modifiedItem}
if {_level} is 1:
set {_amount} to 0.5
else if {_level} is 2:
set {_amount} to 1
else if {_level} is 3:
set {_amount} to 1.5
set {_addNbt} to "{AttributeModifiers:[{AttributeName:""generic.attack_speed"",Amount:%{_amount}%,Operation:0,Slot:mainHand,UUID:[I;%{_uuid1}%,%{_uuid2}%,%{_uuid3}%,%{_uuid4}%],Name:""generic.attack_speed"",Damage:0}]}"
if {_nbt} contains "AttributeModifiers":
set {_existingModifiers::*} to compound list tag "AttributeModifiers" of {_nbt}
add nbt compound of {_newModifiers} to {_existingModifiers::*}
set compound list tag "AttributeModifiers" of {_nbt} to {_existingModifiers::*}
else:
set compound list tag "AttributeModifiers" of {_nbt} to {_newModifiers}
add nbt compound of {_addNbt} to nbt compound of {_modifiedItem}
remove 1 of {_weapon} from {_p}
give 1 of {_modifiedItem} to {_p}
setRuneLore({_p}, {_modifiedItem}, "속공", {_level})
set {rune::weapon::atkSpeed::%{_modifiedItem}'s uuid%} to true
데미지 관련 구문이 보이지 않음