本文整理汇总了C#中CSAngband.Parser.getrand方法的典型用法代码示例。如果您正苦于以下问题:C# Parser.getrand方法的具体用法?C# Parser.getrand怎么用?C# Parser.getrand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSAngband.Parser
的用法示例。
在下文中一共展示了Parser.getrand方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: parse_a_p
public static Parser.Error parse_a_p(Parser p)
{
Artifact a = p.priv as Artifact;
random_value hd = p.getrand("hd");
Misc.assert(a != null);
a.ac = (short)p.getint("ac");
a.dd = (byte)hd.dice;
a.ds = (byte)hd.sides;
a.to_h = (short)p.getint("to-h");
a.to_d = (short)p.getint("to-d");
a.to_a = (short)p.getint("to-a");
return Parser.Error.NONE;
}
示例2: parse_r_b
public static Parser.Error parse_r_b(Parser p)
{
Monster_Race r = p.priv as Monster_Race;
int i;
random_value dam;
if (r == null)
return Parser.Error.MISSING_RECORD_HEADER;
for (i = 0; i < Monster_Blow.MONSTER_BLOW_MAX; i++)
//used to check .method
if (r.blow[i] == null)
break;
if (i == Monster_Blow.MONSTER_BLOW_MAX)
return Parser.Error.TOO_MANY_ENTRIES;
r.blow[i] = new Monster_Blow();
r.blow[i].method = find_blow_method(p.getsym("method"));
if (r.blow[i].method == null)
return Parser.Error.UNRECOGNISED_BLOW;
if (p.hasval("effect")) {
r.blow[i].effect = find_blow_effect(p.getsym("effect"));
if (r.blow[i].effect == null)
return Parser.Error.INVALID_EFFECT;
}
if (p.hasval("damage")) {
dam = p.getrand("damage");
r.blow[i].d_dice = (byte)dam.dice;
r.blow[i].d_side = (byte)dam.sides;
}
return Parser.Error.NONE;
}
示例3: parse_a_e
public static Parser.Error parse_a_e(Parser p)
{
Artifact a = p.priv as Artifact;
Misc.assert(a != null);
a.effect = grab_one_effect(p.getsym("name"));
a.time = p.getrand("time");
if (a.effect == null)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例4: parse_k_m
public static Parser.Error parse_k_m(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.gen_mult_prob = (byte)p.getint("prob");
k.stack_size = (random_value)p.getrand("stack");
return Parser.Error.NONE;
}
示例5: parse_k_p
public static Parser.Error parse_k_p(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
random_value hd = p.getrand("hd");
k.ac = (byte)p.getint("ac");
k.dd = (byte)hd.dice;
k.ds = (byte)hd.sides;
k.to_h = p.getrand("to-h");
k.to_d = p.getrand("to-d");
k.to_a = p.getrand("to-a");
return Parser.Error.NONE;
}
示例6: parse_k_l
public static Parser.Error parse_k_l(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.pval[k.num_pvals] = p.getrand("pval");
if (!p.hasval("flags")) {
k.num_pvals++;
return Parser.Error.NONE;
}
string s = p.getstr("flags");
//return grab_flag_helper(s, k.pval_flags[k.num_pvals]);
string[] t = s.Split(new string[] { " ", "|" }, StringSplitOptions.RemoveEmptyEntries);
string temp;
foreach(string token in t) {
temp = token;
if(grab_flag(k.flags, Object_Flag.list, token) != Parser.Error.NONE ||
grab_flag(k.pval_flags[k.num_pvals], Object_Flag.list, token) != Parser.Error.NONE) {
return Parser.Error.INVALID_FLAG;
}
}
k.num_pvals++;
if (k.num_pvals > Misc.MAX_PVALS)
return Parser.Error.TOO_MANY_ENTRIES;
return Parser.Error.NONE;
//t = strtok(s, " |");
//while (t) {
// if (grab_flag(k.flags, OF_SIZE, k_info_flags, t) ||
// grab_flag(k.pval_flags[k.num_pvals], OF_SIZE, k_info_flags, t))
// break;
// t = strtok(null, " |");
//}
//k.num_pvals++;
//if (k.num_pvals > MAX_PVALS)
// return Parser.Error.TOO_MANY_ENTRIES;
//mem_free(s);
//return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;
}
示例7: parse_k_e
public static Parser.Error parse_k_e(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.effect = grab_one_effect(p.getsym("name"));
if (p.hasval("time"))
k.time = p.getrand("time");
if (k.effect == null)
return Parser.Error.GENERIC;
return Parser.Error.NONE;
}
示例8: parse_k_c
public static Parser.Error parse_k_c(Parser p)
{
Object_Kind k = p.priv as Object_Kind;
Misc.assert(k != null);
k.charge = p.getrand("charges");
return Parser.Error.NONE;
}
示例9: parse_e_l
public static Parser.Error parse_e_l(Parser p)
{
Ego_Item e = p.priv as Ego_Item;
if (e == null)
return Parser.Error.MISSING_RECORD_HEADER;
if (!p.hasval("flags"))
return Parser.Error.MISSING_FIELD;
e.pval[e.num_pvals] = p.getrand("pval");
e.min_pval[e.num_pvals] = (byte)p.getint("min");
string s = p.getstr("flags");
return grab_flag_helper2(s, e);
/*t = strtok(s, " |");
while (t) {
if (grab_flag(e.flags, OF_SIZE, k_info_flags, t) ||
grab_flag(e.pval_flags[e.num_pvals], OF_SIZE, k_info_flags, t))
break;
t = strtok(null, " |");
}
e.num_pvals++;
if (e.num_pvals > MAX_PVALS)
return Parser.Error.TOO_MANY_ENTRIES;
mem_free(s);
return t ? Parser.Error.INVALID_FLAG : Parser.Error.NONE;*/
}
示例10: parse_e_c
public static Parser.Error parse_e_c(Parser p)
{
random_value th = p.getrand("th");
random_value td = p.getrand("td");
random_value ta = p.getrand("ta");
Ego_Item e = p.priv as Ego_Item;
if (e == null)
return Parser.Error.MISSING_RECORD_HEADER;
e.to_h = th;
e.to_d = td;
e.to_a = ta;
return Parser.Error.NONE;
}