User:びゃっこ/すたぶ/解析状態異常: Difference between revisions
(Created page with "主に属性強度(eleP、状態異常の通りやすさのあれ)と 状態異常にかかる際の軽減についての処理なんかを記載する予定。 DamageHPの一部とCondition.csとかを中心に見ていく。") |
No edit summary |
||
| Line 3: | Line 3: | ||
DamageHPの一部とCondition.csとかを中心に見ていく。 | DamageHPの一部とCondition.csとかを中心に見ていく。 | ||
{| class="wikitable" | |||
|910 | |||
|eleFire | |||
|火炎 | |||
|- | |||
|911 | |||
|eleCold | |||
|冷気 | |||
|- | |||
|912 | |||
|eleLightning | |||
|電撃 | |||
|- | |||
|913 | |||
|eleDarkness | |||
|暗黒 | |||
|- | |||
|914 | |||
|eleMind | |||
|幻惑 | |||
|- | |||
|915 | |||
|elePoison | |||
|毒 | |||
|- | |||
|916 | |||
|eleNether | |||
|地獄 | |||
|- | |||
|917 | |||
|eleSound | |||
|轟音 | |||
|- | |||
|918 | |||
|eleNerve | |||
|神経 | |||
|- | |||
|919 | |||
|eleHoly | |||
|神聖 | |||
|- | |||
|920 | |||
|eleChaos | |||
|混沌 | |||
|- | |||
|921 | |||
|eleMagic | |||
|魔法 | |||
|- | |||
|922 | |||
|eleEther | |||
|エーテル | |||
|- | |||
|923 | |||
|eleAcid | |||
|酸 | |||
|- | |||
|924 | |||
|eleCut | |||
|出血 | |||
|- | |||
|925 | |||
|eleImpact | |||
|衝撃 | |||
|- | |||
|926 | |||
|eleVoid | |||
|無 | |||
|- | |||
|950 | |||
|resFire | |||
|火炎耐性 | |||
|- | |||
|951 | |||
|resCold | |||
|冷気耐性 | |||
|- | |||
|952 | |||
|resLightning | |||
|電撃耐性 | |||
|- | |||
|953 | |||
|resDarkness | |||
|暗黒耐性 | |||
|- | |||
|954 | |||
|resMind | |||
|幻惑耐性 | |||
|- | |||
|955 | |||
|resPoison | |||
|毒耐性 | |||
|- | |||
|956 | |||
|resNether | |||
|地獄耐性 | |||
|- | |||
|957 | |||
|resSound | |||
|音耐性 | |||
|- | |||
|958 | |||
|resNerve | |||
|神経耐性 | |||
|- | |||
|959 | |||
|resChaos | |||
|混沌耐性 | |||
|- | |||
|960 | |||
|resHoly | |||
|神聖耐性 | |||
|- | |||
|961 | |||
|resMagic | |||
|魔法耐性 | |||
|- | |||
|962 | |||
|resEther | |||
|エーテル耐性 | |||
|- | |||
|963 | |||
|resAcid | |||
|酸耐性 | |||
|- | |||
|964 | |||
|resCut | |||
|出血耐性 | |||
|- | |||
|965 | |||
|resImpact | |||
|衝撃耐性 | |||
|} | |||
==DamageHP== | |||
===ダメージが正という条件=== | |||
bool Chance(int a, int max) | |||
{ | |||
if (dmg > 0 || (origin != null && origin.HasElement(1345))) | |||
{ | |||
return Mathf.Min(a, max) > EClass.rnd(100); | |||
} | |||
return false; | |||
} | |||
ダメージが正か、キズアミを信仰しているときに、 | |||
入力値a(ただし上限のmaxが存在)が乱数0~99より大きいとき、trueを返します。 | |||
状態異常付与に用いられる関数です。 | |||
==Condition.cs== | |||
===条件=== | |||
public Condition AddCondition<T>(int p = 100, bool force = false) where T : Condition | |||
{ | |||
return AddCondition(typeof(T).Name, p, force); | |||
} | |||
public Condition AddCondition(string id, int p = 100, bool force = false) | |||
{ | |||
return AddCondition(Condition.Create(id, p), force); | |||
} | |||
public Condition AddCondition(Condition c, bool force = false) | |||
{ | |||
c.owner = this; | |||
if (!(c is ConBurning)) | |||
{ | |||
if (c is ConBleed && ResistLv(964) >= 3) | |||
{ | |||
return null; | |||
} | |||
} | |||
else if (ResistLv(950) >= 3) | |||
{ | |||
return null; | |||
} | |||
炎上付与が無効化されるのは、 | |||
* キャラが炎上していない、そして出血状態かつ、出血耐性評価が素晴らしい以上のとき | |||
* 火炎耐性評価が素晴らしい以上のとき | |||
if (c.GainResistFactor > 0 && CanGainConResist) | |||
{ | |||
if (c.GainResistFactor >= 400) | |||
{ | |||
c.power /= 2; | |||
} | |||
ResistCon(c); | |||
if (c.power <= 0) | |||
{ | |||
return null; | |||
} | |||
} | |||
if (!force) | |||
{ | |||
if (c.source.negate.Length != 0) | |||
{ | |||
string[] negate = c.source.negate; | |||
foreach (string text in negate) | |||
{ | |||
if (HasElement(text)) | |||
{ | |||
return null; | |||
} | |||
} | |||
} | |||
Element defenseAttribute = c.GetDefenseAttribute(this); | |||
if (defenseAttribute != null) | |||
{ | |||
c.power = 100 * c.power / (100 + defenseAttribute.Value); | |||
} | |||
if (c.source.resistance.Length != 0) | |||
{ | |||
int num = ResistLv(EClass.sources.elements.alias[c.source.resistance[0]].id); | |||
if (num > 0) | |||
{ | |||
c.power /= num * num + 1; | |||
if (c.power <= 40) | |||
{ | |||
return null; | |||
} | |||
} | |||
} | |||
c.power = c.EvaluatePower(c.power); | |||
if (c.power <= 0) | |||
{ | |||
return null; | |||
} | |||
} | |||
for (int j = 0; j < conditions.Count; j++) | |||
{ | |||
if (conditions[j].id != c.id) | |||
{ | |||
continue; | |||
} | |||
if (c.Type == ConditionType.Stance || c.IsToggle) | |||
{ | |||
conditions[j].Kill(); | |||
return null; | |||
} | |||
if (conditions[j].CanStack(c)) | |||
{ | |||
if (conditions[j].WillOverride) | |||
{ | |||
conditions[j].Kill(silent: true); | |||
continue; | |||
} | |||
if (CanGainConResist) | |||
{ | |||
AddResistCon(c); | |||
} | |||
conditions[j].OnStacked(c.power); | |||
conditions[j].OnStartOrStack(); | |||
conditions[j].PlayEffect(); | |||
} | |||
if (!conditions[j].AllowMultipleInstance) | |||
{ | |||
return null; | |||
} | |||
} | |||
foreach (Condition condition in conditions) | |||
{ | |||
if (condition.TryNullify(c)) | |||
{ | |||
return null; | |||
} | |||
} | |||
int num2 = c.EvaluateTurn(c.power); | |||
if (num2 == 0) | |||
{ | |||
return null; | |||
} | |||
c.value = num2; | |||
conditions.Add(c); | |||
if (CanGainConResist) | |||
{ | |||
AddResistCon(c); | |||
} | |||
c.SetOwner(this); | |||
c.Start(); | |||
SetDirtySpeed(); | |||
if (c.ShouldRefresh) | |||
{ | |||
Refresh(); | |||
} | |||
if (IsPC && c.ConsumeTurn && !EClass.pc.isRestrained) | |||
{ | |||
EClass.player.EndTurn(); | |||
} | |||
if (c.SyncRide && (ride != null || parasite != null)) | |||
{ | |||
if (ride != null) | |||
{ | |||
ride.AddCondition(Condition.Create(c.source.alias, c.power)); | |||
} | |||
if (parasite != null) | |||
{ | |||
parasite.AddCondition(Condition.Create(c.source.alias, c.power)); | |||
} | |||
} | |||
return c; | |||
} | |||
Revision as of 07:00, 23 March 2025
主に属性強度(eleP、状態異常の通りやすさのあれ)と 状態異常にかかる際の軽減についての処理なんかを記載する予定。
DamageHPの一部とCondition.csとかを中心に見ていく。
| 910 | eleFire | 火炎 |
| 911 | eleCold | 冷気 |
| 912 | eleLightning | 電撃 |
| 913 | eleDarkness | 暗黒 |
| 914 | eleMind | 幻惑 |
| 915 | elePoison | 毒 |
| 916 | eleNether | 地獄 |
| 917 | eleSound | 轟音 |
| 918 | eleNerve | 神経 |
| 919 | eleHoly | 神聖 |
| 920 | eleChaos | 混沌 |
| 921 | eleMagic | 魔法 |
| 922 | eleEther | エーテル |
| 923 | eleAcid | 酸 |
| 924 | eleCut | 出血 |
| 925 | eleImpact | 衝撃 |
| 926 | eleVoid | 無 |
| 950 | resFire | 火炎耐性 |
| 951 | resCold | 冷気耐性 |
| 952 | resLightning | 電撃耐性 |
| 953 | resDarkness | 暗黒耐性 |
| 954 | resMind | 幻惑耐性 |
| 955 | resPoison | 毒耐性 |
| 956 | resNether | 地獄耐性 |
| 957 | resSound | 音耐性 |
| 958 | resNerve | 神経耐性 |
| 959 | resChaos | 混沌耐性 |
| 960 | resHoly | 神聖耐性 |
| 961 | resMagic | 魔法耐性 |
| 962 | resEther | エーテル耐性 |
| 963 | resAcid | 酸耐性 |
| 964 | resCut | 出血耐性 |
| 965 | resImpact | 衝撃耐性 |
DamageHP
ダメージが正という条件
bool Chance(int a, int max)
{
if (dmg > 0 || (origin != null && origin.HasElement(1345)))
{
return Mathf.Min(a, max) > EClass.rnd(100);
}
return false;
}
ダメージが正か、キズアミを信仰しているときに、
入力値a(ただし上限のmaxが存在)が乱数0~99より大きいとき、trueを返します。
状態異常付与に用いられる関数です。
Condition.cs
条件
public Condition AddCondition<T>(int p = 100, bool force = false) where T : Condition
{
return AddCondition(typeof(T).Name, p, force);
}
public Condition AddCondition(string id, int p = 100, bool force = false)
{
return AddCondition(Condition.Create(id, p), force);
}
public Condition AddCondition(Condition c, bool force = false)
{
c.owner = this;
if (!(c is ConBurning))
{
if (c is ConBleed && ResistLv(964) >= 3)
{
return null;
}
}
else if (ResistLv(950) >= 3)
{
return null;
}
炎上付与が無効化されるのは、
- キャラが炎上していない、そして出血状態かつ、出血耐性評価が素晴らしい以上のとき
- 火炎耐性評価が素晴らしい以上のとき
if (c.GainResistFactor > 0 && CanGainConResist)
{
if (c.GainResistFactor >= 400)
{
c.power /= 2;
}
ResistCon(c);
if (c.power <= 0)
{
return null;
}
}
if (!force)
{
if (c.source.negate.Length != 0)
{
string[] negate = c.source.negate;
foreach (string text in negate)
{
if (HasElement(text))
{
return null;
}
}
}
Element defenseAttribute = c.GetDefenseAttribute(this);
if (defenseAttribute != null)
{
c.power = 100 * c.power / (100 + defenseAttribute.Value);
}
if (c.source.resistance.Length != 0)
{
int num = ResistLv(EClass.sources.elements.alias[c.source.resistance[0]].id);
if (num > 0)
{
c.power /= num * num + 1;
if (c.power <= 40)
{
return null;
}
}
}
c.power = c.EvaluatePower(c.power);
if (c.power <= 0)
{
return null;
}
}
for (int j = 0; j < conditions.Count; j++)
{
if (conditions[j].id != c.id)
{
continue;
}
if (c.Type == ConditionType.Stance || c.IsToggle)
{
conditions[j].Kill();
return null;
}
if (conditions[j].CanStack(c))
{
if (conditions[j].WillOverride)
{
conditions[j].Kill(silent: true);
continue;
}
if (CanGainConResist)
{
AddResistCon(c);
}
conditions[j].OnStacked(c.power);
conditions[j].OnStartOrStack();
conditions[j].PlayEffect();
}
if (!conditions[j].AllowMultipleInstance)
{
return null;
}
}
foreach (Condition condition in conditions)
{
if (condition.TryNullify(c))
{
return null;
}
}
int num2 = c.EvaluateTurn(c.power);
if (num2 == 0)
{
return null;
}
c.value = num2;
conditions.Add(c);
if (CanGainConResist)
{
AddResistCon(c);
}
c.SetOwner(this);
c.Start();
SetDirtySpeed();
if (c.ShouldRefresh)
{
Refresh();
}
if (IsPC && c.ConsumeTurn && !EClass.pc.isRestrained)
{
EClass.player.EndTurn();
}
if (c.SyncRide && (ride != null || parasite != null))
{
if (ride != null)
{
ride.AddCondition(Condition.Create(c.source.alias, c.power));
}
if (parasite != null)
{
parasite.AddCondition(Condition.Create(c.source.alias, c.power));
}
}
return c;
}