@@ -15,6 +15,8 @@ import org.cneko.justarod.item.JRItems
1515import net.minecraft.entity.effect.StatusEffectInstance
1616import net.minecraft.entity.effect.StatusEffects
1717import org.cneko.justarod.entity.Pregnant
18+ import org.cneko.justarod.item.addEffect
19+ import org.cneko.toneko.common.mod.util.TickTaskQueue
1820
1921// 继承自 MedicalItem
2022class ScalpelItem (settings : Settings ) : MedicalItem(settings.maxCount(1).maxDamage(4)) {
@@ -44,6 +46,8 @@ class ScalpelItem(settings: Settings) : MedicalItem(settings.maxCount(1).maxDama
4446 } else if (stack.containsEnchantment(JREnchantments .UTERUS_INSTALLATION )) {
4547 val offHandStack = user.getStackInHand(if (hand == Hand .MAIN_HAND ) Hand .OFF_HAND else Hand .MAIN_HAND )
4648 return target.isHysterectomy && offHandStack.isOf(JRItems .UTERUS ) // 目标需要安装,且使用者副手持有子宫
49+ }else if (stack.containsEnchantment(JREnchantments .ARTIFICIAL_ABORTION )){
50+ return target.pregnant > 0
4751 }
4852
4953 return false // 没有对应附魔,无法使用
@@ -63,6 +67,8 @@ class ScalpelItem(settings: Settings) : MedicalItem(settings.maxCount(1).maxDama
6367 // canApply已经检查过副手,这里为了更明确的消息再次检查
6468 val offHandStack = user.getStackInHand(Hand .OFF_HAND ) // 假设主手是手术刀
6569 if (! offHandStack.isOf(JRItems .UTERUS )) return Text .of(" §c你的副手必须持有子宫才能执行此操作!" )
70+ }else if (stack.containsEnchantment(JREnchantments .ARTIFICIAL_ABORTION )){
71+ return if (user == target) Text .of(" §c你没有怀孕!" ) else Text .of(" §c对方没有怀孕" )
6672 }
6773
6874 return Text .of(" §c不满足使用条件。" ) // 默认失败消息
@@ -93,6 +99,35 @@ class ScalpelItem(settings: Settings) : MedicalItem(settings.maxCount(1).maxDama
9399 if (offHandStack.isOf(JRItems .UTERUS )) {
94100 offHandStack.decrement(1 )
95101 }
102+ }else if (stack.containsEnchantment(JREnchantments .ARTIFICIAL_ABORTION )){
103+ val pre = target.pregnant
104+ if (pre > 20 * 60 * 20 * 5 ) {
105+ val task = TickTaskQueue ()
106+ target.damage(target.world.damageSources.generic(), 2f ) // 初始伤害
107+
108+ // 安排持续伤害模拟大出血
109+ for (i in 1 .. 10 ) { // 从1开始产生延迟
110+ task.addTask(20 * i) {
111+ if (! target.isDead) {
112+ target.damage(target.world.damageSources.generic(), 2f )
113+ }
114+ }
115+ }
116+ // 有20%概率因并发症导致永久绝育和恶心
117+ if (target.random.nextInt(5 ) == 0 ) {
118+ target.isSterilization = true
119+ target.addEffect(StatusEffects .NAUSEA , 0 , 20 * 15 ) // 恶心效果持续15秒
120+
121+ // 通知玩家出现并发症
122+ val complicationMsg = " §c并发症!手术对你造成了永久性损伤!"
123+ if (user != target) {
124+ user.sendMessage(Text .of(" §e并发症发生了..." ), false )
125+ }
126+ target.sendMessage(Text .of(complicationMsg))
127+ }
128+ }
129+ target.pregnant = 0
130+ target.dropStack(JRItems .MOLE .defaultStack)
96131 }
97132 }
98133
0 commit comments