Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TODO] 护符的获取以及相关物品调整 #1466

Open
XeKr opened this issue Jan 7, 2025 · 1 comment
Open

[TODO] 护符的获取以及相关物品调整 #1466

XeKr opened this issue Jan 7, 2025 · 1 comment
Labels
📋️ TODO Content planned for production

Comments

@XeKr
Copy link
Contributor

XeKr commented Jan 7, 2025

Matters to be added to TODO - 将要加入TODO的事项

护符的获取以及相关物品调整

Describe what this TODO will do - 描述这个TODO要做的事情


护符盒为不可堆叠,各种护符均为不可堆叠


(主手或副手)持有护符盒受到致命伤害时,自动消耗背包中的不死图腾免死(跟不死图腾一样虚空伤害和kill不触发)
如果背包中没有不死图腾,护符盒本身被消耗且发动不死图腾的免死能力


每消耗一个不死图腾或护符盒,尝试一次护符抽取,根据致命伤害的类型决定产生的护符

成功率:
消耗不死图腾时为5%,消耗护符盒时为20%,但背包中已经有同种护符时恒为0%

类型——致命伤害来源:
绿宝石护符——铁傀儡、灾厄村民
黄玉护符——闪电、特斯拉塔
红宝石护符——火焰、熔岩、岩浆块等烫脚方块、激光
蓝宝石护符——水中缺氧窒息、守卫者、远古守卫者
铁砧护符——铁砧砸、巨型铁砧撼地、铁砧锤攻击、飞行头戴铁砧锤撞击
齿轮护符——来自机械动力的伤害(仅在与机械动力同装时存在)
战友护符——其他玩家(无小队或同小队,不同队伍的玩家伤害不触发)
羽毛护符——摔落伤害
猫护符——苦力怕、幻翼
狗护符——骷髅、流浪者、凋零骷髅、沼骇
寂静护符——监守者

抽取失败时,增加该玩家对应的5%概率(加算),最高提高到50%,直到抽取成功后复位概率(背包中已经有同种护符时恒为0%,不增加)

@XeKr XeKr added the 📋️ TODO Content planned for production label Jan 7, 2025
@XeKr XeKr added this to AnvilCraft Jan 7, 2025
@XeKr XeKr moved this to Todo in AnvilCraft Jan 7, 2025
@YocyCraft
Copy link
Contributor

YocyCraft commented Jan 7, 2025

代码模拟平均需要抽取5.3次得到一个护符

roll: 1 prob: 0.049996 acc_prob: 0.049996 rem_prob: 0.950004
roll: 2 prob: 0.0950385 acc_prob: 0.145035 rem_prob: 0.854965
roll: 3 prob: 0.128266 acc_prob: 0.273301 rem_prob: 0.726699
roll: 4 prob: 0.145335 acc_prob: 0.418636 rem_prob: 0.581364
roll: 5 prob: 0.145371 acc_prob: 0.564007 rem_prob: 0.435993
roll: 6 prob: 0.130796 acc_prob: 0.694803 rem_prob: 0.305197
roll: 7 prob: 0.106788 acc_prob: 0.801591 rem_prob: 0.198409
roll: 8 prob: 0.0793552 acc_prob: 0.880946 rem_prob: 0.119054
roll: 9 prob: 0.0535831 acc_prob: 0.934529 rem_prob: 0.065471
roll: 10 prob: 0.032684 acc_prob: 0.967213 rem_prob: 0.0327871
roll: 11 prob: 0.0163846 acc_prob: 0.983597 rem_prob: 0.0164025
roll: 12 prob: 0.00819537 acc_prob: 0.991793 rem_prob: 0.00820716
roll: 13 prob: 0.00410575 acc_prob: 0.995899 rem_prob: 0.00410141
roll: 14 prob: 0.00204807 acc_prob: 0.997947 rem_prob: 0.00205334
roll: 15 prob: 0.00102872 acc_prob: 0.998975 rem_prob: 0.00102462
roll: 16 prob: 0.00051236 acc_prob: 0.999488 rem_prob: 0.00051226
roll: 17 prob: 0.0002571 acc_prob: 0.999745 rem_prob: 0.00025516
roll: 18 prob: 0.00012908 acc_prob: 0.999874 rem_prob: 0.00012608
roll: 19 prob: 6.372e-05 acc_prob: 0.999938 rem_prob: 6.236e-05
roll: 20 prob: 3.062e-05 acc_prob: 0.999968 rem_prob: 3.174e-05
roll: 21 prob: 1.594e-05 acc_prob: 0.999984 rem_prob: 1.58e-05
roll: 22 prob: 7.65e-06 acc_prob: 0.999992 rem_prob: 8.15e-06
roll: 23 prob: 4.17e-06 acc_prob: 0.999996 rem_prob: 3.98e-06
roll: 24 prob: 1.97e-06 acc_prob: 0.999998 rem_prob: 2.01e-06
roll: 25 prob: 1.05e-06 acc_prob: 0.999999 rem_prob: 9.6e-07
roll: 26 prob: 5.1e-07 acc_prob: 1 rem_prob: 4.5e-07
roll: 27 prob: 1.9e-07 acc_prob: 1 rem_prob: 2.6e-07
roll: 28 prob: 1.2e-07 acc_prob: 1 rem_prob: 1.4e-07
roll: 29 prob: 7e-08 acc_prob: 1 rem_prob: 7e-08
roll: 30 prob: 4e-08 acc_prob: 1 rem_prob: 3e-08
roll: 31 prob: 1e-08 acc_prob: 1 rem_prob: 2e-08
roll: 32 prob: 2e-08 acc_prob: 1 rem_prob: 0
avg_roll: 5.30275

源代码:

#include <bits/stdc++.h>

using namespace std;

const char nl = '\n';
using ll = long long;
using tmii = map<int, int>;
#define nano (chrono::system_clock::now().time_since_epoch().count())
#define init_rng mt19937_64 rng(nano ^ 19980731)

init_rng;
double nextDouble(){
	return rng()*5.4210108624275221700372640043497e-20;
}

bool chance(double p){
	return nextDouble() <= p;
}

int main(){
	int TEST = 100000000;
	double p0 = 0.05;
	double delta_p = 0.05;
	double p_max = 0.5;
	tmii count;
	for(int i=0;i<TEST;i++){
		int roll=0;
		double p = p0;
		while(true){
			roll++;
			if(chance(p)) break;
			p=min(p_max, p+delta_p);
		}
		count[roll]++;
	}
	ll total_roll=0;
	int acc_freq=0;
	for(auto [roll, freq]:count) {
		total_roll+=(ll)roll*freq;
		acc_freq+=freq;
		cout<<"roll: "<<roll<<" prob: "<<freq / (double)TEST<<
		" acc_prob: "<<acc_freq/(double)TEST<<" rem_prob: "<<(TEST-acc_freq)/ (double)TEST<<nl;
	}
	double avg_roll=total_roll/(double)TEST;
	cout<<"avg_roll: "<<avg_roll;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📋️ TODO Content planned for production
Projects
Status: Todo
Development

No branches or pull requests

2 participants