forked from github/server
magicians can always identify their own curse-effects.
magic-resistance on a building is always visible to anybody, just like it is on units.
This commit is contained in:
parent
93f3a85d48
commit
816243d2d7
|
@ -390,7 +390,7 @@
|
||||||
<text locale="de">"Die Ausrüstung von $unit($unit) scheint unsichtbar. ($int36($id))"</text>
|
<text locale="de">"Die Ausrüstung von $unit($unit) scheint unsichtbar. ($int36($id))"</text>
|
||||||
<text locale="en">"$unit($unit)'s equipment is invisible. ($int36($id))"</text>
|
<text locale="en">"$unit($unit)'s equipment is invisible. ($int36($id))"</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="curseinfo::magicresistance" section="events">
|
<message name="curseinfo::magicresistance_unit" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
<arg name="id" type="int"/>
|
<arg name="id" type="int"/>
|
||||||
|
@ -398,7 +398,7 @@
|
||||||
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
|
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
|
||||||
<text locale="en">"The magical resistance has been strengthened. ($int36($id))"</text>
|
<text locale="en">"The magical resistance has been strengthened. ($int36($id))"</text>
|
||||||
</message>
|
</message>
|
||||||
<message name="curseinfo::homestone" section="events">
|
<message name="curseinfo::magicresistance_building" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="building" type="building"/>
|
<arg name="building" type="building"/>
|
||||||
<arg name="id" type="int"/>
|
<arg name="id" type="int"/>
|
||||||
|
|
|
@ -250,9 +250,7 @@ cr_output_curses(stream *out, const faction * viewer, const void *obj, objtype_t
|
||||||
curse *c = (curse *)a->data.v;
|
curse *c = (curse *)a->data.v;
|
||||||
message *msg;
|
message *msg;
|
||||||
|
|
||||||
if (c->type->cansee) {
|
self = curse_cansee(c, viewer, typ, obj, self);
|
||||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
|
||||||
}
|
|
||||||
msg = msg_curse(c, obj, typ, self);
|
msg = msg_curse(c, obj, typ, self);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
|
|
|
@ -642,6 +642,17 @@ void transfer_curse(unit * u, unit * u2, int n)
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
int curse_cansee(const curse *c, const faction *viewer, objtype_t typ, const void *obj, int self) {
|
||||||
|
if (self < 3 && c->magician && c->magician->faction == viewer) {
|
||||||
|
// magicians can see their own curses better than anybody, no exceptions
|
||||||
|
self = 3;
|
||||||
|
}
|
||||||
|
else if (c->type->cansee) {
|
||||||
|
self = c->type->cansee(viewer, obj, typ, c, self);
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
bool curse_active(const curse * c)
|
bool curse_active(const curse * c)
|
||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
|
|
|
@ -303,7 +303,7 @@ extern "C" {
|
||||||
const char *oldcursename(int id);
|
const char *oldcursename(int id);
|
||||||
struct message *cinfo_simple(const void *obj, objtype_t typ,
|
struct message *cinfo_simple(const void *obj, objtype_t typ,
|
||||||
const struct curse *c, int self);
|
const struct curse *c, int self);
|
||||||
|
int curse_cansee(const struct curse *c, const struct faction *viewer, objtype_t typ, const void *obj, int self);
|
||||||
#define is_cursed(a, id, id2) \
|
#define is_cursed(a, id, id2) \
|
||||||
curse_active(get_curse(a, ct_find(oldcursename(id))))
|
curse_active(get_curse(a, ct_find(oldcursename(id))))
|
||||||
#define get_curseeffect(a, id, id2) \
|
#define get_curseeffect(a, id, id2) \
|
||||||
|
|
|
@ -520,9 +520,7 @@ nr_curses_i(stream *out, int indent, const faction *viewer, objtype_t typ, const
|
||||||
if (fval(a->type, ATF_CURSE)) {
|
if (fval(a->type, ATF_CURSE)) {
|
||||||
curse *c = (curse *)a->data.v;
|
curse *c = (curse *)a->data.v;
|
||||||
|
|
||||||
if (c->type->cansee) {
|
self = curse_cansee(c, viewer, typ, obj, self);
|
||||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
|
||||||
}
|
|
||||||
msg = msg_curse(c, obj, typ, self);
|
msg = msg_curse(c, obj, typ, self);
|
||||||
|
|
||||||
if (msg) {
|
if (msg) {
|
||||||
|
|
|
@ -9,14 +9,14 @@ static struct message *cinfo_magicresistance(const void *obj, objtype_t typ, con
|
||||||
if (typ == TYP_UNIT) {
|
if (typ == TYP_UNIT) {
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
const struct unit *u = (const struct unit *)obj;
|
const struct unit *u = (const struct unit *)obj;
|
||||||
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
return msg_message(mkname("curseinfo", "magicresistance_unit"), "unit id", u,
|
||||||
c->no);
|
c->no);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (typ == TYP_BUILDING) {
|
if (typ == TYP_BUILDING) {
|
||||||
const struct building *b = (const struct building *)obj;
|
const struct building *b = (const struct building *)obj;
|
||||||
return msg_message(mkname("curseinfo", self ? "homestone" : "buildingunknown"), "id building", c->no, b);
|
return msg_message(mkname("curseinfo", "magicresistance_building"), "id building", c->no, b);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue