Jump to content

How can i check if Enemy is poisoned in Python?


Recommended Posts

static const std::list<UINT> affectContainer { CInstanceBase::AFFECT_INVISIBILITY
, CInstanceBase::AFFECT_POISON, CInstanceBase::AFFECT_FIRE
#ifdef ENABLE_WOLFMAN_CHARACTER
, CInstanceBase::AFFECT_BLEEDING
#endif
};

PyObject * IsAffect(PyObject * poSelf, PyObject * poArgs)
{
	int iVID;
	if (!(PyTuple_GetInteger(poArgs, 0, &iVID)))
		return Py_BuildException();

	int uAffect;
	if (!(PyTuple_GetInteger(poArgs, 1, &uAffect)))
		return Py_BuildException();

	if (std::find(affectContainer.begin(), affectContainer.end(), (UINT)uAffect) == affectContainer.end())
		return Py_BuildValue("b", false);

	auto pInstance = CPythonCharacterManager::Instance().GetInstancePtr(iVID);
	return Py_BuildValue("b", pInstance ? pInstance->IsAffect((UINT)uAffect) : false);
}

 

  • Love 2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.