23 lines
697 B
Python
23 lines
697 B
Python
import sys
|
|
from typing import Any
|
|
|
|
|
|
def uppercase_attrs(source: Any) -> dict[str, Any]:
|
|
return {key: value for key, value in source.__dict__.items() if key and key[0].isupper()}
|
|
|
|
|
|
def apply_uppercase_attrs(character: Any, source: Any) -> None:
|
|
# if source.SkillAttack is not None and source.SkillAttack != 0:
|
|
# frame = sys._getframe(1) # 1 表示上一级调用帧
|
|
# caller_name = frame.f_code.co_name
|
|
# print(caller_name, source.SkillAttack)
|
|
character.SetStatus(**uppercase_attrs(source))
|
|
|
|
|
|
def execute_effect(effects: Any, key: str, *args: Any) -> bool:
|
|
fun = effects.execture(key)
|
|
if fun is None:
|
|
return False
|
|
fun(*args)
|
|
return True
|