Skip to content

Commit

Permalink
女仆的弹幕不会对玩家和女仆造成伤害
Browse files Browse the repository at this point in the history
  • Loading branch information
ENIACJushi committed Jul 2, 2024
1 parent 01aa33c commit 9db0f6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 0 additions & 2 deletions Docs/TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

- 多余的p点变成经验
- 若女仆有名字,则照片、魂符和胶片也被命名为这个名字;若魂符本身在铁砧被命名,则原名称会保留;
- 女仆的弹幕不会对玩家和女仆造成伤害
-

隙间

Expand Down
19 changes: 10 additions & 9 deletions TouHouLittleMaid_BP/scripts/src/danmaku/DanmakuInterface.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ export class DanmakuInterface{
* @param {Entity} target 受击者
* @returns {boolean}
*/
static applyDamage(source, danmaku, target){
static applyDamage(_source, danmaku, target){
try{
// Get source entity by event or property
// const damageOptions = {"damagingProjectile": projectile}; // 弹射物伤害
var damageOptions = {"cause" : EntityDamageCause.magic} // 魔法伤害
//// 设置伤害施加者 ////
let source = _source;
if(source === undefined){
// 没有原版框架下的攻击实体,则通过动态属性寻找
let id = danmaku.getDynamicProperty("source");
Expand All @@ -76,17 +77,17 @@ export class DanmakuInterface{
if(target.id == source.id){ return false; };
// 玩家受击
if(target.typeId==="minecraft:player"){
// 女仆不伤害主人
// 女仆不伤害玩家
let ownerID = danmaku.getDynamicProperty("owner");
if(ownerID!==undefined && ownerID===target.id){
if(ownerID!==undefined){// && ownerID===target.id
return false;
}
}
// 女仆受击
else if(target.typeId==="thlmm:maid"){
let targetOwnerID = EntityMaid.Owner.getID(target); // 目标的主人
if(targetOwnerID !== undefined){
// 主人不伤害自己的女仆
/// 主人不伤害自己的女仆
// 脚本发射
if(targetOwnerID === danmaku.getDynamicProperty("source")){
return false;
Expand All @@ -95,11 +96,11 @@ export class DanmakuInterface{
if(source.id !== undefined && targetOwnerID === source.id){
return false;
}
// 女仆不伤害相同主人的女仆
let sourceOwnerID = danmaku.getDynamicProperty("owner");
if(sourceOwnerID!==undefined && sourceOwnerID === targetOwnerID){
return false;
}
}
/// 女仆不伤害女仆
let sourceOwnerID = danmaku.getDynamicProperty("owner");
if(sourceOwnerID !== undefined){
return false;
}
}
// 不伤害自己的坐骑
Expand Down

0 comments on commit 9db0f6c

Please sign in to comment.